Merge branch 'master' of github.com:sinatra/sinatra

This commit is contained in:
Konstantin Haase 2012-05-30 08:15:24 +02:00
commit 0c2190b8a6
3 changed files with 9 additions and 9 deletions

View File

@ -100,7 +100,7 @@ class DelegatorTest < Test::Unit::TestCase
assert_equal ["helpers", mixin.to_s], app.last_call assert_equal ["helpers", mixin.to_s], app.last_call
end end
it "registers helpers with the delegation target" do it "registers middleware with the delegation target" do
app, mixin = mirror, Module.new app, mixin = mirror, Module.new
Sinatra.use mixin Sinatra.use mixin
assert_equal ["use", mixin.to_s], app.last_call assert_equal ["use", mixin.to_s], app.last_call

View File

@ -156,11 +156,11 @@ class BeforeFilterTest < Test::Unit::TestCase
end end
class AfterFilterTest < Test::Unit::TestCase class AfterFilterTest < Test::Unit::TestCase
it "executes filters in the order defined" do it "executes before and after filters in correct order" do
invoked = 0 invoked = 0
mock_app do mock_app do
before { invoked = 2 } before { invoked = 2 }
get('/') { invoked += 2 } get('/') { invoked += 2; 'hello' }
after { invoked *= 2 } after { invoked *= 2 }
end end
@ -410,7 +410,7 @@ class AfterFilterTest < Test::Unit::TestCase
assert ran assert ran
end end
it 'is possible to apply user_agent conditions to before filters with a path' do it 'is possible to apply user_agent conditions to after filters with a path' do
ran = false ran = false
mock_app do mock_app do
after('/foo', :user_agent => /foo/) { ran = true } after('/foo', :user_agent => /foo/) { ran = true }

View File

@ -31,12 +31,12 @@ class HelpersTest < Test::Unit::TestCase
assert_body 'true' assert_body 'true'
end end
it 'is false for status > 404' do it 'is false for status gt 404' do
status_app(405) { not_found? } status_app(405) { not_found? }
assert_body 'false' assert_body 'false'
end end
it 'is false for status < 404' do it 'is false for status lt 404' do
status_app(403) { not_found? } status_app(403) { not_found? }
assert_body 'false' assert_body 'false'
end end
@ -601,7 +601,7 @@ class HelpersTest < Test::Unit::TestCase
assert_equal '<sinatra></sinatra>', body assert_equal '<sinatra></sinatra>', body
end end
it 'sets the Content-Type response header without extname' do it 'sets the Content-Type response header with extname' do
mock_app do mock_app do
get('/attachment') do get('/attachment') do
content_type :atom content_type :atom
@ -812,12 +812,12 @@ class HelpersTest < Test::Unit::TestCase
assert_not_nil response['Expires'] assert_not_nil response['Expires']
end end
it 'allows passing time objects' do it 'allows passing Time.now objects' do
get '/bar' get '/bar'
assert_not_nil response['Expires'] assert_not_nil response['Expires']
end end
it 'allows passing time objects' do it 'allows passing Time.at objects' do
get '/baz' get '/baz'
assert_equal 'Thu, 01 Jan 1970 00:00:00 GMT', response['Expires'] assert_equal 'Thu, 01 Jan 1970 00:00:00 GMT', response['Expires']
end end