Search code examples
ruby-on-railsminitestcustom-routes

minitest-rails : Test controller with full url


I want to test my controllers with minitest but : - I use custom routing only - I don't use named routes

I have some routes like this :

scope "administration" do
  get '', to: 'administration#index'
  get 'user/:id/update/', to: 'user#update'
end

scope "front" do
  get 'user/show', to: 'user#show'
end

Is there a way to test a request with full url (get "/administration/user/2/update/" for example)?


Solution

  • Controller tests need the controller and actions to be known to the router, but you invoke the action directly without using the path. If you want to pass paths then you want to use Integration tests instead. You don't need to use named routes for either.