require 'spec_helper' RSpec.describe 'Unescape rendering', type: :render do it 'parses unescape script' do expect(render_string('%span!= "hello

unescape

world"')).to eq("hello

unescape

world
\n") expect(render_string(<\nhello

unescape

world\n\n") %span != "hello

unescape

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')).to eq("=
hello\n") expect(render_string('%p!== =#{"
"}hello')).to eq("

=
hello

\n") end context 'with preserve' do it 'keeps newlines within preserve tags' do expect(render_string('!~ "

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