New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Anonymous controller breaks ActionController::UrlGenerator on delete route #2045
Comments
What does your routing look like for |
@JonRowe is this because we don't reset the routes after the routes.draw call? |
@samphippen No I think it's because we use the default "multiple resources" REST routes e.g. |
ahh gotcha. I think this is probably a valid bug then. I'll see if I can work up a fix. |
Having an anonymous controller breaks my routes also. require 'rails_helper'
RSpec.describe Users::SessionsController, type: :controller do
fixtures :users
controller do
end
describe "GET #ask_email" do
it "returns a success response" do
get :ask_email, params: {}
expect(response).to be_successful
end
end
end Results in
Simply removing the |
@cjbottaro in your case this is expected, |
What Ruby, Rails and RSpec versions are you using?
Ruby version: 2.5.1
Rails version: 5.2
Rspec version: 3.9.0
Observed behaviour
When adding an anonymous controller to a controller test suite, it breaks the delete route. Removing the anonymous controller leaves everything else working fine.
Expected behaviour
I expect:
delete :destroy
To not throw:
When an anonymous controller is present.
Can you provide an example app?
ActionController::UrlGenerationError: No route matches {:action=>"destroy", :controller=>"sessions"}
If the anonymous controller is removed, the delete paths run as expected.
The text was updated successfully, but these errors were encountered: