Skip to content

Commit

Permalink
Remove deprecated methods in ActionDispatch::TestResponse
Browse files Browse the repository at this point in the history
`#success?`, `missing?` and `error?` were deprecated in Rails 5.2 in favor of
`#successful?`, `not_found?` and `server_error?`.
  • Loading branch information
rafaelfranca committed Jan 17, 2019
1 parent 12f55ce commit 13ddc92
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 34 deletions.
7 changes: 7 additions & 0 deletions 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`.
Expand Down
27 changes: 0 additions & 27 deletions actionpack/lib/action_dispatch/testing/test_response.rb
Expand Up @@ -14,33 +14,6 @@ def self.from_response(response)
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
Expand Down
7 changes: 0 additions & 7 deletions actionpack/test/dispatch/test_response_test.rb
Expand Up @@ -27,11 +27,4 @@ def assert_response_code_range(range, predicate)
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

0 comments on commit 13ddc92

Please sign in to comment.