Skip to content

Commit

Permalink
more tests for expires helper
Browse files Browse the repository at this point in the history
  • Loading branch information
rkh committed Feb 26, 2011
1 parent 6d9a652 commit 13aea02
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions test/helpers_test.rb
Expand Up @@ -533,23 +533,41 @@ def send_file_app(opts={})

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
Expand Down

0 comments on commit 13aea02

Please sign in to comment.