more tests for expires helper

This commit is contained in:
Konstantin Haase 2011-02-26 15:53:36 +01:00
parent 6d9a6525c7
commit 13aea029f9
1 changed files with 23 additions and 5 deletions

View File

@ -533,23 +533,41 @@ class HelpersTest < Test::Unit::TestCase
describe 'expires' do
setup do
mock_app {
get '/' do
mock_app do
get '/foo' do
expires 60, :public, :no_cache
'Hello World'
end
}
get '/bar' do
expires Time.now
end
get '/baz' do
expires Time.at(0)
end
end
end
it 'sets the Cache-Control header' do
get '/'
get '/foo'
assert_equal ['public', 'no-cache', 'max-age=60'], response['Cache-Control'].split(', ')
end
it 'sets the Expires header' do
get '/'
get '/foo'
assert_not_nil response['Expires']
end
it 'allows passing time objects' do
get '/bar'
assert_not_nil response['Expires']
end
it 'allows passing time objects' do
get '/baz'
assert_equal 'Thu, 01 Jan 1970 00:00:00 GMT', response['Expires']
end
end
describe 'last_modified' do