jeudi 26 mars 2015

How to test custom routes in controller with rspec

I have defined a custom route in routes.rb



get "packages/city/:location_id", to: "packages#index"


In controller_spec.rb,



get :index


gives this error, ActionController::UrlGenerationError: No route matches {:action=>"index", :controller=>"packages"}


How to explicitly specify the custom routes in controller specs?


Aucun commentaire:

Enregistrer un commentaire