Skip to content

Remove infer_spec_type_from_location! from generator #2803

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

Closed
runephilosof-abtion opened this issue Sep 12, 2024 · 1 comment · Fixed by #2804
Closed

Remove infer_spec_type_from_location! from generator #2803

runephilosof-abtion opened this issue Sep 12, 2024 · 1 comment · Fixed by #2804

Comments

@runephilosof-abtion
Copy link

Is your feature request related to a problem? Please describe.
Be consistent. Don't make infer spec types the default, and then also generate the types in the spec files. Also don't describe it as opt-in, when it is on by default.

rubocop-rails has a cop that helps with this inconsistency and removes the types in the spec files

After setting up rspec-rails, you will have enabled config.infer_spec_type_from_file_location! by default in spec/rails_helper.rb. This cop works in conjunction with this config.

Describe the solution you'd like
Remove infer_spec_type_from_location! from

config.infer_spec_type_from_file_location!

It is described as the old behavior.

`config.infer_spec_type_from_file_location!`, which is still supplied

The old behaviour

But it is not very old or opt-in, because it is still enabled by default in the generator.
This PR describes it as "truly opt-in".
But, for that to be true, infer_spec_type_from_location! would have to be commented out or removed in the generator.

Describe alternatives you've considered
Make it configurable whether type: is generated by the spec generators

RSpec.describe <%= class_name %>, <%= type_metatag(:model) %> do

Additional context
Add any other context or screenshots about the feature request here.

@JonRowe
Copy link
Member

JonRowe commented Sep 17, 2024

Thanks for the heads up, I agree it should be at least commented out and the wording flipped, so I've done this in #2804

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants