Skip to content

Commit

Permalink
Explicit default Performance/Sum cop config for the spec
Browse files Browse the repository at this point in the history
If not explicitly specified, it depends on `config/default.yml`,
which is the result of configuration file loading as a side effect of the Inject mechanism.
  • Loading branch information
koic committed Feb 2, 2025
1 parent 349ae04 commit 074bd2a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions spec/rubocop/cop/performance/sum_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Performance::Sum, :config do
let(:cop_config) { { 'SafeAutoCorrect' => false, 'OnlySumOrWithInitialValue' => false } }

%i[inject reduce].each do |method|
it "registers an offense and corrects when using `array.#{method}(10, :+)`" do
expect_offense(<<~RUBY, method: method)
Expand Down

0 comments on commit 074bd2a

Please sign in to comment.