mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
more tests for expires helper
This commit is contained in:
parent
6d9a6525c7
commit
13aea029f9
1 changed files with 23 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue