Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

refactored 'assert_redirected_to': local call to validate_request! wi…

…ll be called in assert_response already. changed names of local variables in order to recognize the semantics a bit easier.
  • Loading branch information...
commit 3bfcf5ffc8671f169e2435706709660b3b3cefbe 1 parent b4e5779
thoefer2 thoefer2 authored
Showing with 4 additions and 5 deletions.
  1. +4 −5 actionpack/lib/action_dispatch/testing/assertions/response.rb
9 actionpack/lib/action_dispatch/testing/assertions/response.rb
View
@@ -55,16 +55,15 @@ def assert_response(type, message = nil)
# assert_redirected_to @customer
#
def assert_redirected_to(options = {}, message=nil)
- validate_request!
assert_response(:redirect, message)
return true if options == @response.location
- redirected_to_after_normalization = normalize_argument_to_redirection(@response.location)
- options_after_normalization = normalize_argument_to_redirection(options)
+ redirect_is = normalize_argument_to_redirection(@response.location)
+ redirect_expected = normalize_argument_to_redirection(options)
- if redirected_to_after_normalization != options_after_normalization
- flunk "Expected response to be a redirect to <#{options_after_normalization}> but was a redirect to <#{redirected_to_after_normalization}>"
+ if redirect_is != redirect_expected
+ flunk "Expected response to be a redirect to <#{redirect_expected}> but was a redirect to <#{redirect_is}>"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.