mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
No longer add missing leading / on path args to assert_redirected_to. Deprecated in 2.3.6.
This commit is contained in:
@@ -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!
|
||||
|
||||
@@ -469,9 +469,11 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase
|
||||
assert_redirected_to '/some/path'
|
||||
end
|
||||
|
||||
def test_redirected_to_url_no_leadling_slash
|
||||
def test_redirected_to_url_no_leading_slash_fails
|
||||
process :redirect_to_path
|
||||
assert_redirected_to 'some/path'
|
||||
assert_raise ActiveSupport::TestCase::Assertion do
|
||||
assert_redirected_to 'some/path'
|
||||
end
|
||||
end
|
||||
|
||||
def test_redirected_to_url_full_url
|
||||
|
||||
Reference in New Issue
Block a user