Sha256: a92fed15eefa48582bfb62191faebd91c5f6d9e2377a780cce0d2444aa25625e

Contents?: true

Size: 762 Bytes

Versions: 2

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

2 entries across 2 versions & 1 rubygems

Version Path
faml-0.8.1 spec/tilt_spec.rb
faml-0.8.0 spec/tilt_spec.rb