开发者

Ruby on Rails: What are partial hash arguments and full set arguments?

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 argumen开发者_JAVA技巧t, 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


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.


It looks like

assert_redirected_to :action => :show

is disfavored over

assert_redirected_to :action => :show, :controller => :music
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜