aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorGuillermo Álvarez <guillermo@cientifico.net>2010-06-10 11:41:32 +0200
committerDavid Heinemeier Hansson <david@loudthinking.com>2010-06-10 12:05:12 -0400
commitc4d6245e875bbb276c122a5a401422d341dac4df (patch)
tree54c896bf6e457b9ac076e1a2307224a32a611ce9 /actionpack/test
parente11bb95d56ed77b10d54d9dfe5a3cc4aa48b3a61 (diff)
downloadrails-c4d6245e875bbb276c122a5a401422d341dac4df.tar.gz
rails-c4d6245e875bbb276c122a5a401422d341dac4df.tar.bz2
rails-c4d6245e875bbb276c122a5a401422d341dac4df.zip
Add support for multi-subdomain session by setting cookie host in session cookie so you can share session between www.example.com, example.com and user.example.com. [#4818 state:resolved]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/dispatch/session/cookie_store_test.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/session/cookie_store_test.rb b/actionpack/test/dispatch/session/cookie_store_test.rb
index 21d11ff31c..b542824789 100644
--- a/actionpack/test/dispatch/session/cookie_store_test.rb
+++ b/actionpack/test/dispatch/session/cookie_store_test.rb
@@ -185,6 +185,35 @@ class CookieStoreTest < ActionController::IntegrationTest
end
end
+ def test_session_store_with_explicit_domain
+ with_test_route_set(:domain => "example.es") do
+ get '/set_session_value'
+ assert_match /domain=example\.es/, headers['Set-Cookie']
+ headers['Set-Cookie']
+ end
+ end
+
+ def test_session_store_without_domain
+ with_test_route_set do
+ get '/set_session_value'
+ assert_no_match /domain\=/, headers['Set-Cookie']
+ end
+ end
+
+ def test_session_store_with_nil_domain
+ with_test_route_set(:domain => nil) do
+ get '/set_session_value'
+ assert_no_match /domain\=/, headers['Set-Cookie']
+ end
+ end
+
+ def test_session_store_with_all_domains
+ with_test_route_set(:domain => :all) do
+ get '/set_session_value'
+ assert_match /domain=\.example\.com/, headers['Set-Cookie']
+ end
+ end
+
private
# Overwrite get to send SessionSecret in env hash