Skip to content

Commit

Permalink
Merge pull request #1841 from rubocop/add-test
Browse files Browse the repository at this point in the history
Add test case for detect redundant `SafeAutoCorrect: false` config
  • Loading branch information
ydah committed Mar 26, 2024
2 parents ecd945f + 077100f commit 281a65b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spec/project/default_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,17 @@ def cop_configuration(config_key)
expect(cop_configuration('Enabled'))
.to all be(true).or(be(false)).or(eq('pending'))
end

it 'does not include unnecessary `SafeAutoCorrect: false`' do
cop_names.each do |cop_name|
next unless default_config.dig(cop_name, 'Safe') == false

safe_autocorrect = default_config.dig(cop_name, 'SafeAutoCorrect')

expect(safe_autocorrect).not_to(
be(false),
"`#{cop_name}` has unnecessary `SafeAutoCorrect: false` config."
)
end
end
end

0 comments on commit 281a65b

Please sign in to comment.