views:

176

answers:

1

I'm using asserts_redirected_to in my unit tests, and I'm receiving this warning:

DEPRECATION WARNING: Using assert_redirected_to with partial hash arguments is deprecated. Specify the full set arguments instead.

What is a partial hash argument, and what is a full set argument? These aren't terms that I've seen used in the Rails community before, and the only relevant results I can find on Google for these are in reference to this deprecation warning.

Here is my code:

 assert_redirected_to :controller => :user, :action => :search

also tried:

 assert_redirected_to({:controller => :user, :action => :search})

I might have guessed that it feels I'm missing some parameters or something like that, but the API documentation explicitly says that not all parameters need to be included:
http://rails.rubyonrails.org/classes/ActionController/Assertions/ResponseAssertions.html

+1  A: 
http://github.com/rails/rails/blob/ab6d295ce41ba2aad400474dcf45052e7b631b53/actionpack/lib/action_controller/assertions/response_assertions.rb

Check this link. Try giving the same hash you have given in the action.

ramonrails
So it turns out that it was complaining that I was missing some parameters, and the API documentation simply neglected to mention that the feature it describes of not having to provide all arguments is deprecated. Heck, even the comments on the source you linked to say that it's okay without mentioning the deprecation. I can't really imagine even why it's deprecated, seems like an important feature to be able to use the partial hashes.Anyway, thanks for your help on this. Much appreciated.
WIlliam Jones