Sha256: 9a61c209957b9625a0a4d110bf87a5d2f26fc7141e7fd05ef8965c0846e07720

Contents?: true

Size: 624 Bytes

Versions: 11

Compression:

Stored size: 624 Bytes

Contents

require 'spec_helper'

RSpec.describe 'Plain rendering', type: :render do
  it 'outputs literally when prefixed with "\\"' do
    expect(render_string('\= @title')).to eq("= @title\n")
  end

  it 'correctly escapes interpolation' do
    expect(render_string(<<'HAML')).to eq("<span>foo\\3bar</span>\n")
%span foo\\#{1 + 2}bar
HAML
    expect(render_string(<<'HAML')).to eq("<span>foo\\\#{1 + 2}bar</span>\n")
%span foo\\\#{1 + 2}bar
HAML
  end

  it 'raises error when interpolation is unterminated' do
    expect { render_string('%span foo#{1 + 2') }.to raise_error(FastHaml::TextCompiler::InvalidInterpolation)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fast_haml-0.1.10 spec/render/plain_spec.rb
fast_haml-0.1.9 spec/render/plain_spec.rb
fast_haml-0.1.8 spec/render/plain_spec.rb
fast_haml-0.1.7 spec/render/plain_spec.rb
fast_haml-0.1.6 spec/render/plain_spec.rb
fast_haml-0.1.5 spec/render/plain_spec.rb
fast_haml-0.1.4 spec/render/plain_spec.rb
fast_haml-0.1.3 spec/render/plain_spec.rb
fast_haml-0.1.2 spec/render/plain_spec.rb
fast_haml-0.1.1 spec/render/plain_spec.rb
fast_haml-0.1.0 spec/render/plain_spec.rb