diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2010-03-02 14:07:42 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-03-02 14:16:25 -0800 |
commit | 9f83cdc38e03dc3e65a702b00dc4a3cc0bb44e60 (patch) | |
tree | e3d28c9f3bf1522bad9acf1215e255df4cd1d5be /actionpack/lib/action_dispatch/testing | |
parent | 6d7d03b77c281014ab01177ed47b7e887866e3f9 (diff) | |
download | rails-9f83cdc38e03dc3e65a702b00dc4a3cc0bb44e60.tar.gz rails-9f83cdc38e03dc3e65a702b00dc4a3cc0bb44e60.tar.bz2 rails-9f83cdc38e03dc3e65a702b00dc4a3cc0bb44e60.zip |
No longer add missing leading / on path args to assert_redirected_to. Deprecated in 2.3.6.
Diffstat (limited to 'actionpack/lib/action_dispatch/testing')
-rw-r--r-- | actionpack/lib/action_dispatch/testing/assertions/response.rb | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/actionpack/lib/action_dispatch/testing/assertions/response.rb b/actionpack/lib/action_dispatch/testing/assertions/response.rb index c2486d3730..937c9f48d2 100644 --- a/actionpack/lib/action_dispatch/testing/assertions/response.rb +++ b/actionpack/lib/action_dispatch/testing/assertions/response.rb @@ -132,16 +132,21 @@ module ActionDispatch end def normalize_argument_to_redirection(fragment) - after_routing = @controller.url_for(fragment) - if after_routing =~ %r{^\w+://.*} - after_routing - else - # FIXME - this should probably get removed. - if after_routing.first != '/' - after_routing = '/' + after_routing + case fragment + when %r{^\w[\w\d+.-]*:.*} + fragment + when String + if fragment =~ %r{^\w[\w\d+.-]*:.*} + fragment + else + @request.protocol + @request.host_with_port + fragment end - @request.protocol + @request.host_with_port + after_routing - end + when :back + raise RedirectBackError unless refer = @request.headers["Referer"] + refer + else + @controller.url_for(fragment) + end.gsub(/[\r\n]/, '') end def validate_request! |