Sha256: 01bcd497ff839a1a6096cf646b271d862c5aee7cd6fa7d3c1f6d0dc0ccb516da

Contents?: true

Size: 741 Bytes

Versions: 11

Compression:

Stored size: 741 Bytes

Contents

require 'spec_helper'

RSpec.describe 'Tilt integration' do
  def tilt(str)
    Tilt.new('spec.haml') { str }
  end

  it 'renders with fast_haml' do
    expect(Tilt['spec.haml']).to equal(FastHaml::Tilt)
  end

  it 'renders' do
    expect(tilt('%span= 1+2').render).to eq("<span>3</span>\n")
  end

  it 'renders scope' do
    scope = Class.new do
      def hello
        'world'
      end
    end.new

    expect(tilt('%span= hello').render(scope)).to eq("<span>world</span>\n")
  end

  it 'renders locals' do
    expect(tilt('%span= hello').render(Object.new, hello: 'world')).to eq("<span>world</span>\n")
  end

  it 'renders yield block' do
    expect(tilt('%span= yield').render { 'world' }).to eq("<span>world</span>\n")
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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