rubocop-rspec icon indicating copy to clipboard operation
rubocop-rspec copied to clipboard

RSpec/Capybara/FeatureMethods auto-correct is not safe

Open jeppester opened this issue 1 year ago • 2 comments

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 avatar Nov 21 '23 13:11 jeppester

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

  • https://github.com/rubocop/rubocop-rspec/blob/master/lib/rubocop/cop/rspec/capybara/feature_methods.rb

ydah avatar Dec 08 '23 07:12 ydah

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

Thanks for reporting!

pirj avatar Dec 08 '23 12:12 pirj

I am closing this issue, since the RSpec/Capybara/FeatureMethods cop was removed in #1876 / v3.0.0.

bquorning avatar Jul 25 '24 10:07 bquorning