Skip to content

Commit

Permalink
Merge pull request #458 from Earlopain/flaky-autocorrect-specs
Browse files Browse the repository at this point in the history
Fix a random test failure for `Performance/Sum`
  • Loading branch information
koic authored Aug 22, 2024
2 parents 47c0de5 + 12009a6 commit 6f170ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
8 changes: 7 additions & 1 deletion spec/rubocop/cli/autocorrect_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@

include_context 'mock console output'

before do
# Restore injected config as well
around do |ex|
previous_config = RuboCop::ConfigLoader.default_configuration

RuboCop::ConfigLoader.default_configuration = nil
RuboCop::ConfigLoader.default_configuration.for_all_cops['SuggestExtensions'] = false
RuboCop::ConfigLoader.default_configuration.for_all_cops['NewCops'] = 'disable'
ex.call
ensure
RuboCop::ConfigLoader.default_configuration = previous_config
end

it 'corrects `Performance/ConstantRegexp` with `Performance/RegexpMatch`' do
Expand Down
16 changes: 0 additions & 16 deletions spec/rubocop/cop/performance/sum_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,6 @@
^{method}^^^^^ Use `sum` instead of `#{method}(&:+)`, unless calling `#{method}(&:+)` on an empty array.
RUBY

# FIXME: The following failures in JRuby need to be fixed:
# https://github.com/rubocop/rubocop-performance/actions/runs/7013730884/job/19080337215
skip('Unexpected JRuby autocorrection test failure needs to be fixed.') if RUBY_ENGINE == 'jruby'

expect_correction(<<~RUBY)
array.sum
RUBY
Expand All @@ -286,10 +282,6 @@
^{method}^^^^ Use `sum` instead of `#{method}(:+)`, unless calling `#{method}(:+)` on an empty array.
RUBY

# FIXME: The following failures in JRuby need to be fixed:
# https://github.com/rubocop/rubocop-performance/actions/runs/7013730884/job/19080337215
skip('Unexpected JRuby autocorrection test failure needs to be fixed.') if RUBY_ENGINE == 'jruby'

expect_correction(<<~RUBY)
array.sum
RUBY
Expand All @@ -301,10 +293,6 @@
^{method}^^^ Use `sum` instead of `#{method}(:+)`, unless calling `#{method}(:+)` on an empty array.
RUBY

# FIXME: The following failures in JRuby need to be fixed:
# https://github.com/rubocop/rubocop-performance/actions/runs/7013730884/job/19080337215
skip('Unexpected JRuby autocorrection test failure needs to be fixed.') if RUBY_ENGINE == 'jruby'

expect_correction(<<~RUBY)
array.sum
RUBY
Expand All @@ -316,10 +304,6 @@
^{method}^^^^ Use `sum` instead of `#{method}(:+)`.
RUBY

# FIXME: The following failures in JRuby need to be fixed:
# https://github.com/rubocop/rubocop-performance/actions/runs/7013730884/job/19080337215
skip('Unexpected JRuby autocorrection test failure needs to be fixed.') if RUBY_ENGINE == 'jruby'

expect_correction(<<~RUBY)
[1, 2, 3].sum
RUBY
Expand Down

0 comments on commit 6f170ac

Please sign in to comment.