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

RSpec/Capybara/FeatureMethods auto-correct is not safe #1753

Open
jeppester opened this issue Nov 21, 2023 · 2 comments
Open

RSpec/Capybara/FeatureMethods auto-correct is not safe #1753

jeppester opened this issue Nov 21, 2023 · 2 comments

Comments

@jeppester
Copy link

jeppester commented Nov 21, 2023

Given the following file:

RSpec.feature 'Shifts report show' do
end

RSpec/Capybara/FeatureMethods will auto-correct to:

RSpec.expect 'Shifts report show' do
end

But that correction is not safe, since the example group now no longer has type: :feature, which can lead to certain helpers not getting loaded (which is how I discovered the issue).

Either the correction should lead to type: :feature getting added:

RSpec.expect 'Shifts report show', type: :feature do
end

Or the cop should not have auto-correct marked as safe.

Rubocop version: 1.57.2
Rubocop-rspec version: 2.25.0

@jeppester jeppester changed the title RSpec/Capybara/FeatureMethods safe autocorrect is not safe RSpec/Capybara/FeatureMethods auto-correct is not safe Nov 21, 2023
@bquorning bquorning transferred this issue from rubocop/rubocop-rspec Dec 8, 2023
@ydah ydah transferred this issue from rubocop/rubocop-capybara Dec 8, 2023
@ydah
Copy link
Member

ydah commented Dec 8, 2023

memo) RSpec/Capybara/FeatureMethods is a cop belonging to rubocop-rspec

@pirj
Copy link
Member

pirj commented Dec 8, 2023

Or the cop should not auto-correct top-level groups.

Thanks for reporting!

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

No branches or pull requests

3 participants