Ruby on Rails Wednesday, March 28, 2012

Cpx Cpx wrote in post #1053588:
> This line:
> post :create, :comment => @comment.attributes
>
> The second parameter (hash) is the content of params in your controller.
> So
> basically your params[:comment] would be @comment.attributes
>
> So if you expected params[:user_id] then you should pass it to the post
> call
>
> Ahmy Yulrizka
This did it

assert_difference('Comment.count') do
post :create, :comment => @comment.attributes, :user_id => 2
end

Neil

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment