aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/session
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2015-08-24 12:44:01 +0200
committerKasper Timm Hansen <kaspth@gmail.com>2015-08-24 12:44:01 +0200
commitb9825801e2cbb39fafc761ea24667e714d3cee2f (patch)
treee84263a49fe56a05fc9245b0385000c57ebe70ab /actionpack/test/dispatch/session
parenta256a5790a907c67b823496f0ed15a705418291c (diff)
parent3a161e65e76a83be6d62c424227fe10b5b66b77d (diff)
downloadrails-b9825801e2cbb39fafc761ea24667e714d3cee2f.tar.gz
rails-b9825801e2cbb39fafc761ea24667e714d3cee2f.tar.bz2
rails-b9825801e2cbb39fafc761ea24667e714d3cee2f.zip
Merge pull request #21321 from rodzyn/removing_mocha
Get rid of mocha tests in actionpack - part 1
Diffstat (limited to 'actionpack/test/dispatch/session')
-rw-r--r--actionpack/test/dispatch/session/cookie_store_test.rb32
1 files changed, 18 insertions, 14 deletions
diff --git a/actionpack/test/dispatch/session/cookie_store_test.rb b/actionpack/test/dispatch/session/cookie_store_test.rb
index e432c65c62..f07e215e3a 100644
--- a/actionpack/test/dispatch/session/cookie_store_test.rb
+++ b/actionpack/test/dispatch/session/cookie_store_test.rb
@@ -274,28 +274,32 @@ class CookieStoreTest < ActionDispatch::IntegrationTest
with_test_route_set(:expire_after => 5.hours) 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 -0000")
+ cookie_body = nil
- cookies[SessionKey] = SignedBar
+ Time.stub :now, time do
+ expected_expiry = (time + 5.hours).gmtime.strftime("%a, %d %b %Y %H:%M:%S -0000")
- get '/set_session_value'
- assert_response :success
+ cookies[SessionKey] = SignedBar
- cookie_body = response.body
- assert_equal "_myapp_session=#{cookie_body}; path=/; expires=#{expected_expiry}; HttpOnly",
- headers['Set-Cookie']
+ get '/set_session_value'
+ assert_response :success
+
+ cookie_body = response.body
+ assert_equal "_myapp_session=#{cookie_body}; path=/; expires=#{expected_expiry}; HttpOnly",
+ headers['Set-Cookie']
+ end
# 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 -0000")
+ Time.stub :now, time do
+ expected_expiry = (time + 5.hours).gmtime.strftime("%a, %d %b %Y %H:%M:%S -0000")
- get '/no_session_access'
- assert_response :success
+ get '/no_session_access'
+ assert_response :success
- assert_equal "_myapp_session=#{cookie_body}; path=/; expires=#{expected_expiry}; HttpOnly",
- headers['Set-Cookie']
+ assert_equal "_myapp_session=#{cookie_body}; path=/; expires=#{expected_expiry}; HttpOnly",
+ headers['Set-Cookie']
+ end
end
end