diff --git a/spec/rubocop/cop/lint/redundant_cop_enable_directive_spec.rb b/spec/rubocop/cop/lint/redundant_cop_enable_directive_spec.rb index c5f4fa68edf..93d3548a4de 100644 --- a/spec/rubocop/cop/lint/redundant_cop_enable_directive_spec.rb +++ b/spec/rubocop/cop/lint/redundant_cop_enable_directive_spec.rb @@ -325,5 +325,22 @@ # rubocop:enable Layout RUBY end + + it 'registers offense and corrects redundant enabling of department of same cop' do + expect_offense(<<~RUBY) + # rubocop:disable Layout/LineLength + fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = barrrrrrrrrrrrrrrrrrrrrrrrrr + # rubocop:enable Layout + ^^^^^^ Unnecessary enabling of Layout. + some_code + RUBY + + expect_correction(<<~RUBY) + # rubocop:disable Layout/LineLength + fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = barrrrrrrrrrrrrrrrrrrrrrrrrr + + some_code + RUBY + end end end