[rspec-users] Controller tests fail to parse route based on resource
Marcelo de Moraes Serpa
celoserpa at gmail.com
Sun Apr 25 18:52:49 EDT 2010
Hello list,
I have a controller example that looks like this:
it 'Should update (PUT /users/:id)' do
@attributes = @user.attributes
@attributes[:firstname] = "Another one"
lambda {
put user_url(@user), at attributes
User.find(@user.id).firstname == @attributes[:firstname]
response.should redirect_to(users_path)
}.should_not raise_error
end
However, this fails with the following error message
ActionController::UnknownAction in 'UsersController#update on (snip)
No action responded to /users/89/edit. Actions: (snip)
I'm not sure why it is not routing PUT /users/:id to UsersController#update.
Any ideas?
The workaround I have as of now is to:
post :update, {:id => @user.id, :user => @attributes}, which works fine, but
not RESTful.
Cheers,
Marcelo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100425/f8346363/attachment.html>
More information about the rspec-users
mailing list