Sha256: bf36d866a03821277ff7108210b345bb2dbbb78ff75ba64d33c1ea5887afcbcb

Contents?: true

Size: 650 Bytes

Versions: 9

Compression:

Stored size: 650 Bytes

Contents

# frozen-string-literal: true
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

9 entries across 9 versions & 1 rubygems

Version Path
faml-0.7.3 spec/render/plain_spec.rb
faml-0.7.2 spec/render/plain_spec.rb
faml-0.7.1 spec/render/plain_spec.rb
faml-0.7.0 spec/render/plain_spec.rb
faml-0.6.5 spec/render/plain_spec.rb
faml-0.6.4 spec/render/plain_spec.rb
faml-0.6.3 spec/render/plain_spec.rb
faml-0.6.2 spec/render/plain_spec.rb
faml-0.6.1 spec/render/plain_spec.rb