Skip to content

Commit c0af87a

Browse files
committed
Add test case for detect redundant SafeAutoCorrect: false config
Follow up: rubocop/rubocop#11913
1 parent 3873c3e commit c0af87a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

spec/project/default_config_spec.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,17 @@ def cop_configuration(config_key)
8181
expect(cop_configuration('Enabled'))
8282
.to all be(true).or(be(false)).or(eq('pending'))
8383
end
84+
85+
it 'does not include unnecessary `SafeAutoCorrect: false`' do
86+
cop_names.each do |cop_name|
87+
next unless default_config.dig(cop_name, 'Safe') == false
88+
89+
safe_autocorrect = default_config.dig(cop_name, 'SafeAutoCorrect')
90+
91+
expect(safe_autocorrect).not_to(
92+
be(false),
93+
"`#{cop_name}` has unnecessary `SafeAutoCorrect: false` config."
94+
)
95+
end
96+
end
8497
end

0 commit comments

Comments
 (0)