Testing Routes with Rspec in Rails 3 -


i have form suppose post create action doing post index action. decided test routes rspec. in example have test follows.

it "should recognize specific invoices#create route"   assert_routing("/invoices", {:controller => "invoices", :action => "create"}) end 

but when run test coming error.

1) invoicescontroller on :index should recognize specific invoices#create route  failure/error: assert_routing("/invoices", {:controller => "invoices", :action => "create"})  recognized options <{"action"=>"index", "controller"=>"invoices"}> did not match <{"controller"=>"invoices", "action"=>"create"}>, difference: <{"action"=>"create"}>.  expected block return true value. 

so im trying figure out why form doing post on index , why test thinks im doing index route. have tried inserting :method => :post in test doesnt seem work.

have tried this?:

assert_routing({ :path => "invoices", :method => :post },    { :controller => "invoices", :action => "create" }) 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -