Skip to content

Commit

Permalink
Use expect_correction instead of autocorrect_source_with_loop
Browse files Browse the repository at this point in the history
Follow up #8062.

This commit fixes the following build error because
`autocorrect_source_with_loop` has been removed by
rubocop/rubocop@510f3f7f.

```console
% bundle exec rake
(snip)

  1) RuboCop::Cop::Performance::CaseWhenSplat autocorrect moves multiple
  splat condition to the end of the when conditions
     Failure/Error:
       new_source = autocorrect_source_with_loop(<<~RUBY)
         case foo
         when *cond1
           bar
         when *cond2
           foobar
         when 5
           baz
         end
       RUBY

     NoMethodError:
       undefined method `autocorrect_source_with_loop' for
       #<RSpec::ExampleGroups::RuboCopCopPerformanceCaseWhenSplat::Autocorrect:0x00007f881ec9df58>
       Did you mean?  autocorrect_source_file
     # ./spec/rubocop/cop/performance/case_when_splat_spec.rb:277:in
       `block (3 levels) in <top (required)>'

  2) RuboCop::Cop::Performance::CaseWhenSplat autocorrect moves multiple
  out of order splat condition to the end of the when conditions
     Failure/Error:
       new_source = autocorrect_source_with_loop(<<~RUBY)
         case foo
         when *cond1
           bar
         when 3
           doo
         when *cond2
           foobar
         when 6
           baz

     NoMethodError:
       undefined method `autocorrect_source_with_loop' for
       #<RSpec::ExampleGroups::RuboCopCopPerformanceCaseWhenSplat::Autocorrect:0x00007f881ec2df00>
       Did you mean?  autocorrect_source_file
     # ./spec/rubocop/cop/performance/case_when_splat_spec.rb:302:in
       `block (3 levels) in <top (required)>'
```
  • Loading branch information
koic committed Jun 2, 2020
1 parent 73a9015 commit 2d9fc24
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spec/rubocop/cop/performance/case_when_splat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
end

it 'moves multiple splat condition to the end of the when conditions' do
new_source = autocorrect_source_with_loop(<<~RUBY)
new_source = autocorrect_source(<<~RUBY)
case foo
when *cond1
bar
Expand All @@ -299,7 +299,7 @@

it 'moves multiple out of order splat condition to the end ' \
'of the when conditions' do
new_source = autocorrect_source_with_loop(<<~RUBY)
new_source = autocorrect_source(<<~RUBY)
case foo
when *cond1
bar
Expand Down

0 comments on commit 2d9fc24

Please sign in to comment.