Sha256: 56312e32c3fe917dc49fa7e98bdcaa0490794bea19f810f1b95f46ce4dc8b98a

Contents?: true

Size: 762 Bytes

Versions: 9

Compression:

Stored size: 762 Bytes

Contents

# frozen-string-literal: true
require 'spec_helper'

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

  it 'renders with faml' do
    expect(Tilt['spec.haml']).to equal(Faml::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

9 entries across 9 versions & 1 rubygems

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