I have a route that is defined as this in my routes.rb as so
scope ':prefix', as: :foo, controller: 'foo_paths', action: :placeholder do
get 'foo/:id', as: 'result'
end
The issue is when running my test it always returns
Failure/Error: subject { get :placeholder }
ActionController::UrlGenerationError:
No route matches {:action=>"placeholder", :controller=>"foo_paths"}
Here's all my code I can't find any error everything works fine in the browser and rake routes return the expected route.
foo_paths_controller.rb
class FooPathsController < ApplicationController
def placeholder
render nothing: true, status: :service_unavailable
end
end
foo_paths_controller_spec.rb
describe FooPathsController, type: :controller do
describe "GET 'placeholder'" do
subject { get :placeholder }
it 'renders an empty page with service unavailable http error' do
subject
it { expect(subject).to have_http_status(503) }
it { expect(subject.body).to be_blank }
end
end
end
rake routes
foo_result GET /:prefix/foo/:id(.:format) foo_paths#placeholder
Aucun commentaire:
Enregistrer un commentaire