mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Deprecate assert_redirect_to's partial hash matching. This will be fully removed in 3.0.
This commit is contained in:
parent
5ac05f15c6
commit
7f1f16c01f
2 changed files with 8 additions and 2 deletions
|
@ -63,7 +63,10 @@ module ActionController
|
||||||
|
|
||||||
# Support partial arguments for hash redirections
|
# Support partial arguments for hash redirections
|
||||||
if options.is_a?(Hash) && @response.redirected_to.is_a?(Hash)
|
if options.is_a?(Hash) && @response.redirected_to.is_a?(Hash)
|
||||||
return true if options.all? {|(key, value)| @response.redirected_to[key] == value}
|
if options.all? {|(key, value)| @response.redirected_to[key] == value}
|
||||||
|
::ActiveSupport::Deprecation.warn("Using assert_redirected_to with partial hash arguments is deprecated. Specify the full set arguments instead", caller)
|
||||||
|
return true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
redirected_to_after_normalisation = normalize_argument_to_redirection(@response.redirected_to)
|
redirected_to_after_normalisation = normalize_argument_to_redirection(@response.redirected_to)
|
||||||
|
|
|
@ -235,8 +235,11 @@ class RedirectTest < ActionController::TestCase
|
||||||
|
|
||||||
def test_redirect_with_partial_params
|
def test_redirect_with_partial_params
|
||||||
get :module_redirect
|
get :module_redirect
|
||||||
|
|
||||||
|
assert_deprecated do
|
||||||
assert_redirected_to :action => 'hello_world'
|
assert_redirected_to :action => 'hello_world'
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_redirect_to_nil
|
def test_redirect_to_nil
|
||||||
assert_raise(ActionController::ActionControllerError) do
|
assert_raise(ActionController::ActionControllerError) do
|
||||||
|
|
Loading…
Reference in a new issue