diff options
author | Jon Moss <me@jonathanmoss.me> | 2017-01-05 17:39:12 -0500 |
---|---|---|
committer | Jon Moss <me@jonathanmoss.me> | 2017-01-05 17:39:12 -0500 |
commit | c5da6414715e3e61f6e51a40245525aa9504a6f3 (patch) | |
tree | 427d127b00c6316498dabbd5d13f5909d75d7177 /actionpack/test | |
parent | 5f03172f54a58a57a48a3121562beb2cef866cbe (diff) | |
download | rails-c5da6414715e3e61f6e51a40245525aa9504a6f3.tar.gz rails-c5da6414715e3e61f6e51a40245525aa9504a6f3.tar.bz2 rails-c5da6414715e3e61f6e51a40245525aa9504a6f3.zip |
Update `cookies` helper on all HTTP requests
Regression introduced by ae29142142324545a328948e059e8b8118fd7a33 / 8363b879fe759f0645179f4521cc64795efbee6e.
Previously, cookies were only updated on `GET` requests. Now we will
update the helper for all requests, as part of `process`. Added
regression tests for all available HTTP method helpers in
`ActionController::TestCase`.
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/dispatch/cookies_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/cookies_test.rb b/actionpack/test/dispatch/cookies_test.rb index 664faa31bb..73ad677419 100644 --- a/actionpack/test/dispatch/cookies_test.rb +++ b/actionpack/test/dispatch/cookies_test.rb @@ -395,6 +395,15 @@ class CookiesTest < ActionController::TestCase assert_equal false, cookies.deleted?("another") end + # Ensure all HTTP methods have their cookies updated + [:get, :post, :patch, :put, :delete, :head].each do |method| + define_method("test_deleting_cookie_#{method}") do + request.cookies[:user_name] = "Joe" + public_send method, :logout + assert_nil cookies[:user_name] + end + end + def test_deleted_cookie_predicate_with_mismatching_options cookies[:user_name] = "Joe" cookies.delete("user_name", path: "/path") |