From 077100f0df0da81b825f64dc292a1257592e785b Mon Sep 17 00:00:00 2001 From: ydah Date: Tue, 26 Mar 2024 18:35:39 +0900 Subject: [PATCH] Add test case for detect redundant `SafeAutoCorrect: false` config Follow up: https://github.com/rubocop/rubocop/pull/11913 --- spec/project/default_config_spec.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spec/project/default_config_spec.rb b/spec/project/default_config_spec.rb index e024addce..7b02deb72 100644 --- a/spec/project/default_config_spec.rb +++ b/spec/project/default_config_spec.rb @@ -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