[rspec-users] Testing arbitrary post action parameters

James Byrne lists at ruby-forum.com
Sat Jan 17 17:51:35 EST 2009

Pat Maddox wrote:

> Does
> put users_url(user), :user => {:administrator => true}
> not work?

I have spent a good deal of time trying to get this to work with no 
success.  I have read the api regarding the put method in:


which is what I believe provides the put method in the example, but I 
cannot seem to get the signature to work out.

   put(path, parameters = nil, headers = nil)

If the path argument is "users_url(user)" then what is user?  The Rails 
documentation describes the *_url methods thus:

> Behind the scenes the *_url method wraps a call to url_for on the route hash.
> The *_url method takes a single optional argument which is a hash that
> is merged on top of the url_for’ed route. This makes it so that a given
> named route can be parametrized when used with redirect_to, link_to, etc.

If I read this aright then in your example user should be a hash, but a 
hash of what? Where would I create it in my test and what should it 

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

More information about the rspec-users mailing list