require 'spec_helper' RSpec.describe 'JavaScript filter rendering', type: :render do it 'renders javascript filter' do expect(render_string(<\n\nworld\n\n") %div :javascript alert('hello'); %span world HAML end it 'keeps indent' do expect(render_string(<\n\n\n") %div :javascript alert('hello'); alert('world'); HAML end it 'ignores empty filter' do expect(render_string(<\nworld\n\n") %div :javascript %span world HAML end it 'parses string interpolation' do expect(render_string(<<'HAML')).to eq("\n") :javascript var x = #{1 + 2}; HAML end it "doesn't escape in string interpolation" do expect(render_string(<<'HAML')).to eq("\n") :javascript #{''} HAML end end