Skip to content
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

Comment out infer_spec_type_from_file_location! in generated helper. #2804

Merged
merged 2 commits into from
Sep 17, 2024

Conversation

JonRowe
Copy link
Member

@JonRowe JonRowe commented Sep 17, 2024

We would prefer that people tag their specs manually (or via generators) and whilst our generators do generate tags we never removed the generated infer_spec_type_from_file_location! as a default.

Fixes #2803

Copy link
Member

@pirj pirj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@JonRowe JonRowe force-pushed the comment-out-infer-spect-type-by-default branch from 8af9748 to efca529 Compare September 17, 2024 20:07
@JonRowe JonRowe merged commit ab36146 into main Sep 17, 2024
17 checks passed
@JonRowe JonRowe deleted the comment-out-infer-spect-type-by-default branch September 17, 2024 20:44
@JonRowe
Copy link
Member Author

JonRowe commented Nov 9, 2024

Released in 7.1.0

@tisba
Copy link

tisba commented Nov 11, 2024

Out of curiosity, @JonRowe: What is the reasoning behind the recommendation to tag specs manually over inferring from location?

@JonRowe
Copy link
Member Author

JonRowe commented Nov 11, 2024

A combination of factors, it is better to be explicit about things to improve the "documentation" effect, it makes it less surprising when you include extra helpers into different types of specs and its less brittle as an implementation.

@BenMorganMY
Copy link

I think this really goes against the naming conventions that Rails instills.

@JonRowe
Copy link
Member Author

JonRowe commented Nov 12, 2024

I think this really goes against the naming conventions that Rails instills.

Rails doesn't automatically configure things based on directories either, you inherit from classes e.g. ActionController::Base

bfad added a commit to bfad/rubocop-rspec_rails that referenced this pull request Nov 23, 2024
At the time this cop was added, [it was noted][PR Comment] that this was
legacy behavior left as the default for people migrating to RSpec 3. Now
RSpec 7.1.0 has [removed this default][PR] to make it clear that this is
deprecated / legacy behavior, let's delete this cop.

[PR Comment]: rubocop/rubocop-rspec#1365 (comment)
[PR]: rspec/rspec-rails#2804
bfad added a commit to bfad/rubocop-rspec_rails that referenced this pull request Nov 23, 2024
At the time this cop was added, [it was noted][PR Comment] that this was
legacy behavior left as the default for people migrating to RSpec 3. Now
RSpec 7.1.0 has [removed this default][PR] to make it clear that this is
deprecated / legacy behavior, let's delete this cop.

[PR Comment]: rubocop/rubocop-rspec#1365 (comment)
[PR]: rspec/rspec-rails#2804
pirj pushed a commit to bfad/rubocop-rspec_rails that referenced this pull request Nov 25, 2024
At the time this cop was added, [it was noted][PR Comment] that this was
legacy behavior left as the default for people migrating to RSpec 3. Now
RSpec 7.1.0 has [removed this default][PR] to make it clear that this is
deprecated / legacy behavior, let's delete this cop.

[PR Comment]: rubocop/rubocop-rspec#1365 (comment)
[PR]: rspec/rspec-rails#2804
bfad added a commit to bfad/rubocop-rspec_rails that referenced this pull request Nov 25, 2024
At the time this cop was added, [it was noted][PR Comment] that this was
legacy behavior left as the default for people migrating to RSpec 3. Now
RSpec 7.1.0 has [removed this default][PR] to make it clear that this is
deprecated / legacy behavior, let's delete this cop.

[PR Comment]: rubocop/rubocop-rspec#1365 (comment)
[PR]: rspec/rspec-rails#2804
@fonji
Copy link

fonji commented Dec 2, 2024

I think this really goes against the naming conventions that Rails instills.

Rails doesn't automatically configure things based on directories either, you inherit from classes e.g. ActionController::Base

I think it goes against the convention over configuration part of the doctrine. Maybe that's what @BenMorganMY wanted to talk about.

@BenMorganMY
Copy link

@fonji yep, this is primarily about ensuring convention over configuration. It's redundant for a Rails application to also have to specify the spec type and will end up encouraging bad configuration behaviour. This should not be the default in a Rails application.

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 this pull request may close these issues.

Remove infer_spec_type_from_location! from generator
5 participants