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
Add support for Rails engines routes in request specs #2372
Conversation
I guess we'll need a spec for that. |
Great start thanks for tackling, we usually test generators by running them in the example app, tweaking with removing comments etc and then letting them pass |
Thanks for the feedback everyone. I was trying to get a reproducable test case so have been working on that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the additional documentation, but it doesn't test the generator, that still needs to be added ideally.
Currently, when scaffolds are generated inside a Rails Engine, it generates requests specs that fail without modification. This happens because the Engine routes are not mounted under Rails.application. To fix this, Engine routes have to be included so that url and path helpers can be usable from within the spec file.
@JonRowe I've added a test to make sure the route helpers get included. Wanted to get your thoughts on the namespaced include engine route/url helpers -- it looks like Rails generators does not do that, so does it make sense to keep it similar? |
Thanks! |
Currently, when scaffolds are generated inside a Rails Engine, it generates requests specs that fail without modification. This happens because the Engine routes are not mounted under Rails.application.
To fix this, Engine routes have to be included so that url and path helpers can be usable from within the spec file.