test/erb_test.rb in bmizerany-sinatra-0.8.10 vs test/erb_test.rb in bmizerany-sinatra-0.9.0

- old
+ new

@@ -1,50 +1,55 @@ -require File.dirname(__FILE__) + '/helper' +require 'test/spec' +require 'sinatra/base' +require 'sinatra/test' describe "ERB Templates" do + include Sinatra::Test + def erb_app(&block) mock_app { set :views, File.dirname(__FILE__) + '/views' get '/', &block } get '/' end it 'renders inline ERB strings' do erb_app { erb '<%= 1 + 1 %>' } - assert ok? - assert_equal '2', body + should.be.ok + body.should.equal '2' end it 'renders .erb files in views path' do erb_app { erb :hello } - assert ok? - assert_equal "Hello World\n", body + should.be.ok + body.should.equal "Hello World\n" end it 'takes a :locals option' do erb_app { locals = {:foo => 'Bar'} erb '<%= foo %>', :locals => locals } - assert ok? - assert_equal 'Bar', body + should.be.ok + body.should.equal 'Bar' end it "renders with inline layouts" do mock_app { layout { 'THIS. IS. <%= yield.upcase %>!' } get('/') { erb 'Sparta' } } get '/' - assert ok? - assert_equal 'THIS. IS. SPARTA!', body + should.be.ok + body.should.equal 'THIS. IS. SPARTA!' end it "renders with file layouts" do erb_app { erb 'Hello World', :layout => :layout2 } - assert ok? - assert_equal "ERB Layout!\nHello World\n", body + should.be.ok + body.should.equal "ERB Layout!\nHello World\n" end + end