diff --git a/actionpack/lib/action_controller/assertions/response_assertions.rb b/actionpack/lib/action_controller/assertions/response_assertions.rb index 5976090273..43e83ac017 100644 --- a/actionpack/lib/action_controller/assertions/response_assertions.rb +++ b/actionpack/lib/action_controller/assertions/response_assertions.rb @@ -63,7 +63,10 @@ module ActionController # Support partial arguments for hash redirections 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 redirected_to_after_normalisation = normalize_argument_to_redirection(@response.redirected_to) diff --git a/actionpack/test/controller/redirect_test.rb b/actionpack/test/controller/redirect_test.rb index 91e21db854..c457486913 100644 --- a/actionpack/test/controller/redirect_test.rb +++ b/actionpack/test/controller/redirect_test.rb @@ -235,7 +235,10 @@ class RedirectTest < ActionController::TestCase def test_redirect_with_partial_params get :module_redirect - assert_redirected_to :action => 'hello_world' + + assert_deprecated do + assert_redirected_to :action => 'hello_world' + end end def test_redirect_to_nil