aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/session/cookie_store_test.rb
diff options
context:
space:
mode:
authorMichael Lovitt <michael@lovitt.net>2010-06-22 09:55:50 -0400
committerJeremy Kemper <jeremy@bitsweat.net>2010-06-23 11:56:35 -0700
commit49f52c3d910c8f183afc3a54ea2ae9667f23085e (patch)
tree410bc3c8fb8921397547c33fd8661f2015065946 /actionpack/test/dispatch/session/cookie_store_test.rb
parent0bf3baa6b3d216c6340f8d3b5d0a3ebc093e969a (diff)
downloadrails-49f52c3d910c8f183afc3a54ea2ae9667f23085e.tar.gz
rails-49f52c3d910c8f183afc3a54ea2ae9667f23085e.tar.bz2
rails-49f52c3d910c8f183afc3a54ea2ae9667f23085e.zip
Sessions should not be created until written to and session data should be destroyed on reset.
[#4938] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'actionpack/test/dispatch/session/cookie_store_test.rb')
-rw-r--r--actionpack/test/dispatch/session/cookie_store_test.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/actionpack/test/dispatch/session/cookie_store_test.rb b/actionpack/test/dispatch/session/cookie_store_test.rb
index b4380f7818..787524ab7b 100644
--- a/actionpack/test/dispatch/session/cookie_store_test.rb
+++ b/actionpack/test/dispatch/session/cookie_store_test.rb
@@ -83,7 +83,7 @@ class CookieStoreTest < ActionController::IntegrationTest
get '/get_session_id'
assert_response :success
- assert_equal "id: #{session_id}", response.body
+ assert_equal "id: #{session_id}", response.body, "should be able to read session id without accessing the session hash"
end
end
@@ -141,6 +141,15 @@ class CookieStoreTest < ActionController::IntegrationTest
end
end
+ def test_getting_from_nonexistent_session
+ with_test_route_set do
+ get '/get_session_value'
+ assert_response :success
+ assert_equal 'foo: nil', response.body
+ assert_nil headers['Set-Cookie'], "should only create session on write, not read"
+ end
+ end
+
def test_persistent_session_id
with_test_route_set do
cookies[SessionKey] = SignedBar