# 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("3\n")
end
it 'renders scope' do
scope = Class.new do
def hello
'world'
end
end.new
expect(tilt('%span= hello').render(scope)).to eq("world\n")
end
it 'renders locals' do
expect(tilt('%span= hello').render(Object.new, hello: 'world')).to eq("world\n")
end
it 'renders yield block' do
expect(tilt('%span= yield').render { 'world' }).to eq("world\n")
end
end