require 'spec_helper' RSpec.describe 'Unescape rendering', type: :render do it 'parses unescape script' do expect(render_string('%span!= "hello
unescape
world"')).to eq("hellounescape
world\n") expect(render_string(<unescape
world\n\n") %span != "hellounescape
world" HAML end it 'ignores single unescape mark' do expect(render_string('!hello
')).to eq("hello
\n") expect(render_string('%span!hello
')).to eq("hello
\n") end it 'ignores single Unescape mark without spaces' do expect(render_string('!hello
')).to eq("hello
\n") expect(render_string('%span!hello
')).to eq("hello
\n") end it 'has effect on string interpolation in plain' do expect(render_string('!#{"hello"}
')).to eq("hello
\n") expect(render_string('%span!#{"hello"}
')).to eq("hello
\n") end it 'parses == syntax' do expect(render_string('!== =#{"=
hello
hello\n
pre\nworld"')).to eq("
hello\n
pre world\n") expect(render_string('%span!~ "
hello\n
pre\nworld"')).to eq("
hello\n
pre world\n") end end context 'without Ruby code' do it 'raises error' do expect { render_string('%span!=') }.to raise_error(Faml::SyntaxError) expect { render_string('!=') }.to raise_error(Faml::SyntaxError) end end end