Say I have a custom route like this... map.connect ''item/:id/some_action'', :controller => ''object'', :action => ''change_color'', :conditions => {:method => :put} I''ve been writing my tests like this... describe ObjectController describe "PUT item/:id/some_action" do [...] put :change_color, {:id => ''blue''} [...] end end So the test doesn''t actually test the url - "item/blue/some_action", but rather the underlying Controller/Action that implements it. Is there a way to write my tests "in terms of" the url - something like... describe ObjectController describe "PUT item/:id/some_action" do [...] put "item/blue/some_action" [...] end end Or are controller tests simply not the place to do this, and I should do it in Cucumber or something? Cheers -- Posted via http://www.ruby-forum.com/.
...not the place to do this, and I should do it in Cucumber or something? Yes! Tthe concept of testing controllers, views and models separately, is related to isolation of concerns. Your controller test is just that, testing the controller, regardless of routing, views, models, etc. You''re unit testing, so to speak, just object#change_color. This is why mocks and stubs are created as well, to remove the coupling of the three so you can test each on it''s own. Grain of salt disclaimer, I''m not to far down my BDD journey with Rails with RSpec and Cucumber myself.... b -- Posted via http://www.ruby-forum.com/.