aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/cookies_test.rb
diff options
context:
space:
mode:
authorRizwan Reza <rizwanreza@gmail.com>2010-06-11 14:30:35 +0430
committerJosé Valim <jose.valim@gmail.com>2010-06-11 16:34:53 +0200
commit51ad68367a5ea67aee586c6bd9b4017088a093ce (patch)
tree6c617a71d5d252183530adadfd932fe7ccd7e0b9 /actionpack/test/dispatch/cookies_test.rb
parent132730d5db6564d58094d121d4deb19eb2c1cd31 (diff)
downloadrails-51ad68367a5ea67aee586c6bd9b4017088a093ce.tar.gz
rails-51ad68367a5ea67aee586c6bd9b4017088a093ce.tar.bz2
rails-51ad68367a5ea67aee586c6bd9b4017088a093ce.zip
Added tests for cookies with domain option.
Diffstat (limited to 'actionpack/test/dispatch/cookies_test.rb')
-rw-r--r--actionpack/test/dispatch/cookies_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/cookies_test.rb b/actionpack/test/dispatch/cookies_test.rb
index 8c9183e454..b04c1a42c0 100644
--- a/actionpack/test/dispatch/cookies_test.rb
+++ b/actionpack/test/dispatch/cookies_test.rb
@@ -79,6 +79,16 @@ class CookiesTest < ActionController::TestCase
cookies[:user_name] = { :value => "david", :expires => Time.utc(2005, 10, 10,5) }
head :ok
end
+
+ def set_cookie_with_domain
+ cookies[:user_name] = {:value => "rizwanreza", :domain => :all}
+ head :ok
+ end
+
+ def delete_cookie_with_domain
+ cookies.delete(:user_name, :domain => :all)
+ head :ok
+ end
end
tests TestController
@@ -216,6 +226,18 @@ class CookiesTest < ActionController::TestCase
}
end
+ def test_cookie_with_all_domain_option
+ get :set_cookie_with_domain
+ assert_response :success
+ assert_cookie_header "user_name=rizwanreza; domain=.nextangle.com; path=/"
+ end
+
+ def test_deleting_cookie_with_all_domain_option
+ get :delete_cookie_with_domain
+ assert_response :success
+ assert_cookie_header "user_name=; domain=.nextangle.com; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT"
+ end
+
private
def assert_cookie_header(expected)
header = @response.headers["Set-Cookie"]