RecSys_2010
RecSys_2010

Reputation: 375

rspec no route error

I have set up the path in route.rb as the following: post "/orders/:id/capture/.:format"

but when I write the controller's rspec post "capture"

I got error: "can't find route {:controller => :orders, :action => :capture}

why is that?

Upvotes: 1

Views: 317

Answers (1)

stellard
stellard

Reputation: 5314

It is most likely because you are not passing in the order's id.

The route will not match unless all criteria are met.

In your code you have

 post "capture", :order => @order, :format => :json

Is @order set?

Upvotes: 1

Related Questions