On 11 Sep 2009, at 21:28, Giuseppe Bertini wrote:

Hello list,
this should be an easy one, but I seem to be stuck.
What is the proper way to mimic a POST request for a named, non- RESTful
route?

here's the route and the rest of the setup:

map.accept_invitation '/accept_invitation/:id', :controller =>
"invitations", :action => "accept", :method => "post"

class InvitationsController < ApplicationController
 def accept
 end
end

describe InvitationsController do
 describe "POST 'accept'" do
   it "should be successful" do
     post :accept, :id => 1
     response.should be_success
   end
 end
end

When I run this spec, I get:
No route matches {:controller=>"invitations", :action=>"accept",
:id=>"1"}

Can anyone please suggest what I should be writing instead to test this
request?

Looks about right to me. Must be something silly that you've missed, but I'm afraid I can't see it.

cheers,
Matt

+447974 430184
[email protected]
http://mattwynne.net

_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to