Sha256: 9e9f11dd15fc343942dca1a2c271d7376d8c13a5b939ca0beaa0b859547f6aad
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
require 'spec_helper' describe Templates do let (:app) do mock_app do get '/without_layout' do render template('index.erb') end get '/with_layout' do render template('layout.erb') do render template('index.erb') end end get '/instance_var' do @foo = 'bar' render template('instance.erb') end get '/local_var' do render template('local.erb'), :foo => 'bar' end end end it 'renders correctly without layout' do response = app.get('/without_layout') response.body.should == '<p>Hello!</p>' end it 'passes a instance variable to template' do response = app.get('/instance_var') response.body.should == 'bar' end it 'passes a local variable to template' do response = app.get('/local_var') response.body.should == 'bar' end it 'renders correctly with layout' do response = app.get('/with_layout') rendered = Tilt.new(template('layout.erb')).render do Tilt.new(template('index.erb')).render end response.body.should == rendered end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nyny-3.0.1 | spec/templates_spec.rb |
nyny-2.2.1 | spec/templates_spec.rb |