Hi, guys, After reading the rspec book (dec 2010 edition), I went on to write controller specs for an application I'm porting over from rails 2.3.x to rails 3.
1) I ran 'rake routes' and got the following: parts GET /parts(.:format) {:action=>"index", :controller=>"parts"} POST /parts(.:format) {:action=>"create", :controller=>"parts"} new_part GET /parts/new(.:format) {:action=>"new", :controller=>"parts"} edit_part GET /parts/:id/edit(.:format) {:action=>"edit", :controller=>"parts"} part GET /parts/:id(.:format) {:action=>"show", :controller=>"parts"} PUT /parts/:id(.:format) {:action=>"update", :controller=>"parts"} DELETE /parts/:id(.:format) {:action=>"destroy", :controller=>"parts"} 2) I ran 'rake spec:controllers' and got the error below. Pending: PartsController the new part object's updates are saved successfully saves updates to a new part # Not Yet Implemented # ./spec/controllers/parts_controller_spec.rb:59 Failures: 1) PartsController saves updates to an existing part object successfully Failure/Error: put :update#, :part => { 'title' => 'Grimspeed' } ActionController::RoutingError: No route matches {:controller=>"parts", :action=>"update"} # ./spec/controllers/parts_controller_spec.rb:55 3) Here's what the spec reads: it 'saves updates to an existing part object successfully' do Part.should_receive(:update). with( 'title' => 'Brake pads' ). and_return(part) put :update#, :part => { 'title' => 'Brake pads' } end What I do not understand is that the :controller=>"parts", :action=>"update" route actually exists (when I ran "rake routes") but the tests does not acknowledge the existence of the 'update' method in the controller with PUT request. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users