From 62ad3ad75899f3d912dce084bb0d74806fc96dcd Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Tue, 8 Nov 2022 13:54:32 +0900 Subject: [PATCH] Fix a build error Follow up https://github.com/rubocop/rubocop/pull/11163. This commit fixes the following build error: ```console % bundle exec rspec spec/rubocop/cli/autocorrect_spec.rb (snip) Failures: 1) RuboCop::CLI --autocorrect corrects `Style/HashExcept` with `TargetRubyVersion: 2.0` Got 2 failures from failure aggregation block. # ./spec/support/cli_spec_behavior.rb:25:in `block (2 levels) in ' 1.1) Failure/Error: expect(cli.run(['-a', '--only', 'Style/HashExcept'])).to eq(0) expected: 0 got: 1 (compared using ==) # ./spec/rubocop/cli/autocorrect_spec.rb:54:in `block (2 levels) in ' 1.2) Failure/Error: expect(File.read('example.rb')).to eq(<<~RUBY) {foo: 1, bar: 2, baz: 3}.except(:bar) RUBY expected: "{foo: 1, bar: 2, baz: 3}.except(:bar)\n" got: "{foo: 1, bar: 2, baz: 3}.reject {|k, v| k == :bar }\n" (compared using ==) Diff: @@ -1 +1 @@ -{foo: 1, bar: 2, baz: 3}.except(:bar) +{foo: 1, bar: 2, baz: 3}.reject {|k, v| k == :bar } # ./spec/rubocop/cli/autocorrect_spec.rb:55:in `block (2 levels) in ' Finished in 0.28529 seconds (files took 1.12 seconds to load) 3 examples, 1 failure ``` --- spec/rubocop/cli/autocorrect_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/rubocop/cli/autocorrect_spec.rb b/spec/rubocop/cli/autocorrect_spec.rb index 53cc48c1b4..08e9e122ba 100644 --- a/spec/rubocop/cli/autocorrect_spec.rb +++ b/spec/rubocop/cli/autocorrect_spec.rb @@ -51,7 +51,7 @@ {foo: 1, bar: 2, baz: 3}.reject {|k, v| k == :bar } RUBY - expect(cli.run(['-a', '--only', 'Style/HashExcept'])).to eq(0) + expect(cli.run(['-A', '--only', 'Style/HashExcept'])).to eq(0) expect(File.read('example.rb')).to eq(<<~RUBY) {foo: 1, bar: 2, baz: 3}.except(:bar) RUBY