test cache_control without a hash

This commit is contained in:
Konstantin Haase 2011-02-26 15:49:57 +01:00
parent 63022950b4
commit 48196f690e
1 changed files with 14 additions and 4 deletions

View File

@ -507,18 +507,28 @@ class HelpersTest < Test::Unit::TestCase
describe 'cache_control' do describe 'cache_control' do
setup do setup do
mock_app { mock_app do
get '/' do get '/foo' do
cache_control :public, :no_cache, :max_age => 60.0 cache_control :public, :no_cache, :max_age => 60.0
'Hello World' 'Hello World'
end end
}
get '/bar' do
cache_control :public, :no_cache
'Hello World'
end
end
end end
it 'sets the Cache-Control header' do it 'sets the Cache-Control header' do
get '/' get '/foo'
assert_equal ['public', 'no-cache', 'max-age=60'], response['Cache-Control'].split(', ') assert_equal ['public', 'no-cache', 'max-age=60'], response['Cache-Control'].split(', ')
end end
it 'last argument does not have to be a hash' do
get '/bar'
assert_equal ['public', 'no-cache'], response['Cache-Control'].split(', ')
end
end end
describe 'expires' do describe 'expires' do