aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-03-15 23:17:31 -0500
committerJoshua Peek <josh@joshpeek.com>2009-03-15 23:17:31 -0500
commit367049cae69ec535e7105b35f4877167adca1188 (patch)
tree07dfcb609a49b9e989d169972e63d83d0cdb80bc /actionpack
parent39ff550fa88da9a22d8c21ca872f5e4d0d83f8d4 (diff)
downloadrails-367049cae69ec535e7105b35f4877167adca1188.tar.gz
rails-367049cae69ec535e7105b35f4877167adca1188.tar.bz2
rails-367049cae69ec535e7105b35f4877167adca1188.zip
Fix brittle Time.now mock
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/test/controller/session/cookie_store_test.rb20
1 files changed, 4 insertions, 16 deletions
diff --git a/actionpack/test/controller/session/cookie_store_test.rb b/actionpack/test/controller/session/cookie_store_test.rb
index 9c93ca6539..c406188972 100644
--- a/actionpack/test/controller/session/cookie_store_test.rb
+++ b/actionpack/test/controller/session/cookie_store_test.rb
@@ -199,29 +199,17 @@ class CookieStoreTest < ActionController::IntegrationTest
with_test_route_set do
# First request accesses the session
- time = Time.local(2008, 4, 24)
- Time.stubs(:now).returns(time)
- expected_expiry = (time + 5.hours).gmtime.strftime("%a, %d-%b-%Y %H:%M:%S GMT")
-
cookies[SessionKey] = SignedBar
get '/set_session_value'
assert_response :success
+ cookie = headers['Set-Cookie']
- cookie_body = response.body
- assert_equal "_myapp_session=#{cookie_body}; path=/; expires=#{expected_expiry}; HttpOnly",
- headers['Set-Cookie']
-
- # Second request does not access the session
- time = Time.local(2008, 4, 25)
- Time.stubs(:now).returns(time)
- expected_expiry = (time + 5.hours).gmtime.strftime("%a, %d-%b-%Y %H:%M:%S GMT")
-
+ # Second request does not access the session so the
+ # expires header should not be changed
get '/no_session_access'
assert_response :success
-
- assert_equal "_myapp_session=#{cookie_body}; path=/; expires=#{expected_expiry}; HttpOnly",
- headers['Set-Cookie']
+ assert_equal cookie, headers['Set-Cookie']
end
end