aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/cookies_test.rb
diff options
context:
space:
mode:
authorPaul Annesley <paul@annesley.cc>2012-01-24 00:10:43 +1100
committerPaul Annesley <paul@annesley.cc>2012-01-24 00:31:22 +1100
commit5169543a6da2390191f780214e06c578eadb9442 (patch)
tree83eaaf97c6b729fcdb7a849c36a562c95fc23261 /actionpack/test/dispatch/cookies_test.rb
parentec65f144633aaf6791e97173448123790e69ff21 (diff)
downloadrails-5169543a6da2390191f780214e06c578eadb9442.tar.gz
rails-5169543a6da2390191f780214e06c578eadb9442.tar.bz2
rails-5169543a6da2390191f780214e06c578eadb9442.zip
ActionDispatch::Cookies::CookieJar#deleted? predicate method.
Necessary in controller tests to determine if the CookieJar will delete the given cookie.
Diffstat (limited to 'actionpack/test/dispatch/cookies_test.rb')
-rw-r--r--actionpack/test/dispatch/cookies_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/cookies_test.rb b/actionpack/test/dispatch/cookies_test.rb
index 6ebd02e85c..3e48d97e67 100644
--- a/actionpack/test/dispatch/cookies_test.rb
+++ b/actionpack/test/dispatch/cookies_test.rb
@@ -245,6 +245,17 @@ class CookiesTest < ActionController::TestCase
assert_cookie_header "user_name=; path=/beaten; expires=Thu, 01-Jan-1970 00:00:00 GMT"
end
+ def test_deleted_cookie_predicate
+ cookies.delete("user_name")
+ assert cookies.deleted?("user_name")
+ assert_equal false, cookies.deleted?("another")
+ end
+
+ def test_deleted_cookie_predicate_with_mismatching_options
+ cookies.delete("user_name", :path => "/path")
+ assert_equal false, cookies.deleted?("user_name", :path => "/different")
+ end
+
def test_cookies_persist_throughout_request
response = get :authenticate
assert response.headers["Set-Cookie"] =~ /user_name=david/