spec/templates_spec.rb in nyny-2.2.1 vs spec/templates_spec.rb in nyny-3.0.0

- old
+ new

@@ -1,52 +1,52 @@ -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 +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