From f51059ae89922d65eea46f65c04d4bf156437e3e Mon Sep 17 00:00:00 2001 From: Maxim Krizhanovsky Date: Sat, 13 Aug 2022 19:37:18 +0100 Subject: [PATCH] Fix integration test for Rubocop version 1.30 and above (#9) --- .../cop/layout/ordered_methods_spec.rb | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/spec/rubocop/cop/layout/ordered_methods_spec.rb b/spec/rubocop/cop/layout/ordered_methods_spec.rb index d005e82..37ab9bc 100644 --- a/spec/rubocop/cop/layout/ordered_methods_spec.rb +++ b/spec/rubocop/cop/layout/ordered_methods_spec.rb @@ -428,12 +428,21 @@ def self.a; end ]) expect($stderr.string).to eq('') expect(exit_status_code).to eq(::RuboCop::CLI::STATUS_OFFENSES) - expect($stdout.string).to eq(<<~OUTPUT) - == #{file.path} == - C: 3: 3: [Correctable] Layout/OrderedMethods: Methods should be sorted in alphabetical order. - - 1 file inspected, 1 offense detected, 1 offense auto-correctable - OUTPUT + if RuboCop::Version::STRING >= '1.30.0' + expect($stdout.string).to eq(<<~OUTPUT) + == #{file.path} == + C: 3: 3: [Correctable] Layout/OrderedMethods: Methods should be sorted in alphabetical order. + + 1 file inspected, 1 offense detected, 1 offense autocorrectable + OUTPUT + else + expect($stdout.string).to eq(<<~OUTPUT) + == #{file.path} == + C: 3: 3: [Correctable] Layout/OrderedMethods: Methods should be sorted in alphabetical order. + + 1 file inspected, 1 offense detected, 1 offense auto-correctable + OUTPUT + end end end end