aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2019-03-19 21:19:45 -0400
committerGitHub <noreply@github.com>2019-03-19 21:19:45 -0400
commit7c6343078a566264ce6df6e531c9790ff2d2f432 (patch)
treec452643ae06d9de65073892ba91ad8f573a56c34 /actionpack/test/dispatch
parent3dee96e92b08edafa2a7be6964b0596bb738f709 (diff)
parentca937c59cd69c05cbb92bad4839d931061e15b69 (diff)
downloadrails-7c6343078a566264ce6df6e531c9790ff2d2f432.tar.gz
rails-7c6343078a566264ce6df6e531c9790ff2d2f432.tar.bz2
rails-7c6343078a566264ce6df6e531c9790ff2d2f432.zip
Merge pull request #35649 from andrehjr/fix-override-of-cookies-controller-specs
Don't override @set_cookies on CookieJar#update_cookies_from_jar'
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r--actionpack/test/dispatch/cookies_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/cookies_test.rb b/actionpack/test/dispatch/cookies_test.rb
index 4aaac1320e..2c67bb779f 100644
--- a/actionpack/test/dispatch/cookies_test.rb
+++ b/actionpack/test/dispatch/cookies_test.rb
@@ -123,6 +123,11 @@ class CookiesTest < ActionController::TestCase
head :ok
end
+ def set_cookie_if_not_present
+ cookies["user_name"] = "alice" unless cookies["user_name"].present?
+ head :ok
+ end
+
def logout
cookies.delete("user_name")
head :ok
@@ -1128,6 +1133,14 @@ class CookiesTest < ActionController::TestCase
assert_equal "bar", @controller.encrypted_cookie
end
+ def test_cookie_override
+ get :set_cookie_if_not_present
+ assert_equal "alice", cookies["user_name"]
+ cookies["user_name"] = "bob"
+ get :set_cookie_if_not_present
+ assert_equal "bob", cookies["user_name"]
+ end
+
def test_signed_cookie_with_expires_set_relatively
request.env["action_dispatch.use_cookies_with_metadata"] = true