Sha256: aaf528c7a3a2fb4d0f57d64341f23f7bcae60ce0741333a576f3fedd702021a8

Contents?: true

Size: 620 Bytes

Versions: 22

Compression:

Stored size: 620 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(Faml::TextCompiler::InvalidInterpolation)
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
faml-0.6.0 spec/render/plain_spec.rb
faml-0.5.1 spec/render/plain_spec.rb
faml-0.5.0 spec/render/plain_spec.rb
faml-0.4.2 spec/render/plain_spec.rb
faml-0.4.1 spec/render/plain_spec.rb
faml-0.4.0 spec/render/plain_spec.rb
faml-0.3.6 spec/render/plain_spec.rb
faml-0.3.5 spec/render/plain_spec.rb
faml-0.3.4 spec/render/plain_spec.rb
faml-0.3.3 spec/render/plain_spec.rb
faml-0.3.2 spec/render/plain_spec.rb
faml-0.3.1 spec/render/plain_spec.rb
faml-0.3.0 spec/render/plain_spec.rb
faml-0.2.8 spec/render/plain_spec.rb
faml-0.2.7 spec/render/plain_spec.rb
faml-0.2.6 spec/render/plain_spec.rb
faml-0.2.5 spec/render/plain_spec.rb
faml-0.2.4 spec/render/plain_spec.rb
faml-0.2.3 spec/render/plain_spec.rb
faml-0.2.2 spec/render/plain_spec.rb