diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-26 15:18:39 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-26 15:18:39 -0700 |
commit | 77e67f419c21b61350375632d2228adfeeea4604 (patch) | |
tree | d2905c35c2cc5b962122ee761260d060f7409acd /actionpack/lib/action_dispatch/testing/assertions/response.rb | |
parent | 17d0efb67965b0ce88b306fb577425e90cb99155 (diff) | |
parent | 3bfcf5ffc8671f169e2435706709660b3b3cefbe (diff) | |
download | rails-77e67f419c21b61350375632d2228adfeeea4604.tar.gz rails-77e67f419c21b61350375632d2228adfeeea4604.tar.bz2 rails-77e67f419c21b61350375632d2228adfeeea4604.zip |
Merge pull request #2273 from thoefer/refactor
refactored 'assert_redirected_to'
Diffstat (limited to 'actionpack/lib/action_dispatch/testing/assertions/response.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/testing/assertions/response.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/testing/assertions/response.rb b/actionpack/lib/action_dispatch/testing/assertions/response.rb index a2d639cd56..33c6cd5221 100644 --- a/actionpack/lib/action_dispatch/testing/assertions/response.rb +++ b/actionpack/lib/action_dispatch/testing/assertions/response.rb @@ -55,16 +55,15 @@ module ActionDispatch # 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 |