Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a random test failure for Performance/Sum #458

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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