Hello all, I have a spec for a route that used to pass under Rails 2.2.2 and rspec 1.1.12, but can?t figure out what is wrong since I updated. Here is the assertion: route_for( { :controller => ''purchase_orders'', :action => ''update'', :company_id => "32", :id => ''1'' }).should == "/companies/32/purchase_orders/1" Which results in this failure Test::Unit::AssertionFailedError in ''PurchaseOrdersController route generation routes #update to /companies/32/purchase_orders/1'' The recognized options <{"action"=>"show", "id"=>"1", "controller"=>"vendor_purchase_orders", "company_id"=>"company-name"}> did not match <{"action"=>"update", "id"=>"1", "controller"=>"vendor_purchase_orders", "company_id"=>"company-name"}>, difference: <{"action"=>"update"}> As you may have guessed the route is defined like so: Map.resources :companies do |c| c.resources :purchase_orders End Any ideas? Peer Allan
David Chelimsky
2009-Mar-17 04:20 UTC
[rspec-users] Route failure with Rails2.3 and rspec1.2
On Mon, Mar 16, 2009 at 9:22 PM, Peer Allan <Peer.Allan at canadadrugs.com> wrote:> Hello all, > > I have a spec for a route that used to pass under Rails 2.2.2 and rspec > 1.1.12, but can?t figure out what is wrong since I updated. Here is the > assertion: > > route_for( > ? ? ? ?{ > ? ? ? ? ?:controller ? ? ? ? => ''purchase_orders'', > ? ? ? ? ?:action ? ? ? ? ? ? => ''update'', > ? ? ? ? ?:company_id ? ? ? ? => "32", > ? ? ? ? ?:id ? ? ? ? ? ? ? ? => ''1'' > ? ? ? ?}).should == "/companies/32/purchase_orders/1"route_for changed in rspec-rails-1.2.0 Please see the upgrade notes for more info: http://github.com/dchelimsky/rspec-rails/blob/master/Upgrade.markdown Cheers, David> > Which results in this failure > > Test::Unit::AssertionFailedError in ''PurchaseOrdersController route > generation routes #update to /companies/32/purchase_orders/1'' > The recognized options <{"action"=>"show", > ?"id"=>"1", > ?"controller"=>"vendor_purchase_orders", > ?"company_id"=>"company-name"}> did not match <{"action"=>"update", > ?"id"=>"1", > ?"controller"=>"vendor_purchase_orders", > ?"company_id"=>"company-name"}>, difference: <{"action"=>"update"}> > > As you may have guessed the route is defined like so: > > Map.resources :companies do |c| > ?c.resources :purchase_orders > End > > Any ideas? > > Peer Allan > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >