require 'spec_helper' RSpec.describe 'Comment rendering', type: :render do it 'renders html comment' do expect(render_string('/ comments')).to eq("\n") end it 'strips spaces' do expect(render_string('/ comments ')).to eq("\n") end it 'renders structured comment' do expect(render_string(<hello\n\nworld\n") %span hello / great %span world HAML end it 'renders comment with interpolation' do expect(render_string(<<'HAML')).to eq("hello\n\nworld\n") - comment = 'great' %span hello / #{comment} %span world HAML end it 'renders conditional comment' do expect(render_string('/ [if IE] hello')).to eq("\n") end it 'renders conditional comment with children' do expect(render_string(<\nhello\nworld\n\n") /[if IE] %span hello world HAML end it 'parses nested conditional comment' do expect(render_string(<\nhello\nworld\n\n") /[[if IE]] %span hello world HAML end it 'raises error if conditional comment bracket is unbalanced' do expect { render_string('/[[if IE]') }.to raise_error(Faml::SyntaxError) end it 'raises error if both comment text and children are given' do expect { render_string(<