aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/cookies_test.rb
diff options
context:
space:
mode:
authorbrainopia <ravwar@gmail.com>2010-12-09 18:38:52 +0300
committerSantiago Pastorino <santiago@wyeworks.com>2010-12-15 11:03:03 -0200
commit439c23dce33148064c258eaf6e79f9d4563c88a4 (patch)
treee6572953fed0e1db80a36e32e3f8108ff8399104 /actionpack/test/dispatch/cookies_test.rb
parent17afec0ae3fe9d8895a7e030f6bfb8443ae83be1 (diff)
downloadrails-439c23dce33148064c258eaf6e79f9d4563c88a4.tar.gz
rails-439c23dce33148064c258eaf6e79f9d4563c88a4.tar.bz2
rails-439c23dce33148064c258eaf6e79f9d4563c88a4.zip
Fix edge cases for domain :all option on cookie store
Dont set explicit domain for cookies if host is not a domain name [#6002 state:committed] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'actionpack/test/dispatch/cookies_test.rb')
-rw-r--r--actionpack/test/dispatch/cookies_test.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/cookies_test.rb b/actionpack/test/dispatch/cookies_test.rb
index 5ec7f12cc1..e2040401c7 100644
--- a/actionpack/test/dispatch/cookies_test.rb
+++ b/actionpack/test/dispatch/cookies_test.rb
@@ -295,6 +295,27 @@ class CookiesTest < ActionController::TestCase
assert_cookie_header "user_name=rizwanreza; domain=.nextangle.local; path=/"
end
+ def test_cookie_with_all_domain_option_using_localhost
+ @request.host = "localhost"
+ get :set_cookie_with_domain
+ assert_response :success
+ assert_cookie_header "user_name=rizwanreza; path=/"
+ end
+
+ def test_cookie_with_all_domain_option_using_ipv4_address
+ @request.host = "192.168.1.1"
+ get :set_cookie_with_domain
+ assert_response :success
+ assert_cookie_header "user_name=rizwanreza; path=/"
+ end
+
+ def test_cookie_with_all_domain_option_using_ipv6_address
+ @request.host = "2001:0db8:85a3:0000:0000:8a2e:0370:7334"
+ get :set_cookie_with_domain
+ assert_response :success
+ assert_cookie_header "user_name=rizwanreza; path=/"
+ end
+
def test_deleting_cookie_with_all_domain_option
get :delete_cookie_with_domain
assert_response :success