Deprecate assert_redirect_to's partial hash matching. This will be fully removed in 3.0.

This commit is contained in:
Joshua Peek
2009-05-04 20:24:49 -05:00
parent 5ac05f15c6
commit 7f1f16c01f
2 changed files with 8 additions and 2 deletions

View File

@@ -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)

View File

@@ -235,7 +235,10 @@ class RedirectTest < ActionController::TestCase
def test_redirect_with_partial_params def test_redirect_with_partial_params
get :module_redirect get :module_redirect
assert_redirected_to :action => 'hello_world'
assert_deprecated do
assert_redirected_to :action => 'hello_world'
end
end end
def test_redirect_to_nil def test_redirect_to_nil