-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Generate request spec by default when generating controller #2056
Comments
Hello @bekicot and thanks for your request. It seems to me to be a big shift that needs to be addressed in a major release if we do it even if I think it's a good idea. I will follow @JonRowe or @samphippen choice to change this behavior. |
I'd support a PR that made the behaviour configurable, and changed the default the behaviour of the generator for Rails 5.1, (maybe 5) but older Rails expect controller specs |
I think the right thing to do here is to add a configuration option, have
it enabled in new rails helpers on rails greater or equal to 4.2 (which had
request specs), and then turn it on by default for everyone in RSpec rails
4.
|
And/Or a command line option - which also provides the possibility to generate a feature spec A project might have decided to write request specs only for API controllers and feature specs for the controllers with views and user facing functionality. But generally it is not nice that the generated stuff contradicts official recommendations - just leads to discussions everywhere 😉 |
Well given that the next version is a major version, if someone wanted to tackle the default switch over now would be the time. |
I actually didn't want to nag, just chiming about the idea of file configuration. So sorry for the wording. Anyway, I got motivated a bit, but have to stop for now because I can't seem to get the configurability to work, at least according to my tests. For the case If I don't get back to it here is my branch: https://github.com/klyonrad/rspec-rails/commits/controller-default-generated-specs I also started thinking about the scaffolding generators and the suggested cotent for the templates, but well these are maybe different topics. |
try this command |
Hello everyone.
works for me in rails 6 |
What Ruby, Rails and RSpec versions are you using?
Ruby version: 2.4.1
Rails version: 5.2.2
Rspec version: 3.8
Observed behavior
When generating Rails controller, it will automatically generate corresponding controller spec.
Expected behavior
Generate corresponding request spec.
Is it possible for the user to configure RSpec-rails so that it generates request spec by default when generating controller test?
The text was updated successfully, but these errors were encountered: