Permalink
Browse files

more tests for expires helper

  • Loading branch information...
1 parent 6d9a652 commit 13aea029f976c098a4a2f0afa9f175d619c058f0 @rkh rkh committed Feb 26, 2011
Showing with 23 additions and 5 deletions.
  1. +23 −5 test/helpers_test.rb
View
28 test/helpers_test.rb
@@ -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

0 comments on commit 13aea02

Please sign in to comment.