diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2019-01-14 15:03:29 -0500 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2019-01-17 16:08:31 -0500 |
commit | 13ddc92e079e59a0b894e31bf5bb4fdecbd235d1 (patch) | |
tree | 3b39bed26236eb934465cae5f74d4cc3057f9598 | |
parent | 12f55cefde5902962aa8e740c50e5bb4fc6fb53a (diff) | |
download | rails-13ddc92e079e59a0b894e31bf5bb4fdecbd235d1.tar.gz rails-13ddc92e079e59a0b894e31bf5bb4fdecbd235d1.tar.bz2 rails-13ddc92e079e59a0b894e31bf5bb4fdecbd235d1.zip |
Remove deprecated methods in ActionDispatch::TestResponse
`#success?`, `missing?` and `error?` were deprecated in Rails 5.2 in favor of
`#successful?`, `not_found?` and `server_error?`.
-rw-r--r-- | actionpack/CHANGELOG.md | 7 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/testing/test_response.rb | 27 | ||||
-rw-r--r-- | actionpack/test/dispatch/test_response_test.rb | 7 |
3 files changed, 7 insertions, 34 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index 2000be688f..c24bd3344e 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -1,3 +1,10 @@ +* Remove deprecated methods in `ActionDispatch::TestResponse`. + + `#success?`, `missing?` and `error?` were deprecated in Rails 5.2 in favor of + `#successful?`, `not_found?` and `server_error?`. + + *Rafael Mendonça França* + * Ensure external redirects are explicitly allowed Add `fallback_location` and `allow_other_host` options to `redirect_to`. diff --git a/actionpack/lib/action_dispatch/testing/test_response.rb b/actionpack/lib/action_dispatch/testing/test_response.rb index 7c1202dc0e..6f7c86fdcf 100644 --- a/actionpack/lib/action_dispatch/testing/test_response.rb +++ b/actionpack/lib/action_dispatch/testing/test_response.rb @@ -14,33 +14,6 @@ module ActionDispatch new response.status, response.headers, response.body end - # Was the response successful? - def success? - ActiveSupport::Deprecation.warn(<<-MSG.squish) - The success? predicate is deprecated and will be removed in Rails 6.0. - Please use successful? as provided by Rack::Response::Helpers. - MSG - successful? - end - - # Was the URL not found? - def missing? - ActiveSupport::Deprecation.warn(<<-MSG.squish) - The missing? predicate is deprecated and will be removed in Rails 6.0. - Please use not_found? as provided by Rack::Response::Helpers. - MSG - not_found? - end - - # Was there a server-side error? - def error? - ActiveSupport::Deprecation.warn(<<-MSG.squish) - The error? predicate is deprecated and will be removed in Rails 6.0. - Please use server_error? as provided by Rack::Response::Helpers. - MSG - server_error? - end - def parsed_body @parsed_body ||= response_parser.call(body) end diff --git a/actionpack/test/dispatch/test_response_test.rb b/actionpack/test/dispatch/test_response_test.rb index f0b8f7785d..2629a61057 100644 --- a/actionpack/test/dispatch/test_response_test.rb +++ b/actionpack/test/dispatch/test_response_test.rb @@ -27,11 +27,4 @@ class TestResponseTest < ActiveSupport::TestCase response = ActionDispatch::TestResponse.create(200, { "Content-Type" => "application/json" }, '{ "foo": "fighters" }') assert_equal({ "foo" => "fighters" }, response.parsed_body) end - - test "response status aliases deprecated" do - response = ActionDispatch::TestResponse.create - assert_deprecated { response.success? } - assert_deprecated { response.missing? } - assert_deprecated { response.error? } - end end |