From 3c9522e29cc5c851ac8a340bdc59a04046172c69 Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 23 Jul 2024 13:27:07 +0200 Subject: [PATCH] Fix RSpec/AnyInstance Regenerate Rubocop's todo --- .rubocop_todo.yml | 14 +++----------- spec/grape/middleware/base_spec.rb | 2 +- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f4482aff41..10cc2c7ed8 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2024-06-22 17:26:10 UTC using RuboCop version 1.64.1. +# on 2024-07-23 11:24:53 UTC using RuboCop version 1.64.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -37,12 +37,6 @@ Naming/VariableNumber: - 'spec/grape/exceptions/validation_errors_spec.rb' - 'spec/grape/validations_spec.rb' -# Offense count: 2 -RSpec/AnyInstance: - Exclude: - - 'spec/grape/api_spec.rb' - - 'spec/grape/middleware/base_spec.rb' - # Offense count: 1 # Configuration parameters: IgnoredMetadata. RSpec/DescribeClass: @@ -140,15 +134,14 @@ RSpec/RepeatedExampleGroupDescription: - 'spec/grape/util/inheritable_setting_spec.rb' - 'spec/grape/validations/validators/values_spec.rb' -# Offense count: 5 +# Offense count: 4 RSpec/StubbedMock: Exclude: - 'spec/grape/dsl/inside_route_spec.rb' - 'spec/grape/dsl/routing_spec.rb' - 'spec/grape/middleware/formatter_spec.rb' - - 'spec/grape/parser_spec.rb' -# Offense count: 122 +# Offense count: 121 RSpec/SubjectStub: Exclude: - 'spec/grape/api_spec.rb' @@ -164,7 +157,6 @@ RSpec/SubjectStub: - 'spec/grape/middleware/formatter_spec.rb' - 'spec/grape/middleware/globals_spec.rb' - 'spec/grape/middleware/stack_spec.rb' - - 'spec/grape/parser_spec.rb' # Offense count: 23 # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames. diff --git a/spec/grape/middleware/base_spec.rb b/spec/grape/middleware/base_spec.rb index 608c5012ef..a3acc39d5b 100644 --- a/spec/grape/middleware/base_spec.rb +++ b/spec/grape/middleware/base_spec.rb @@ -57,7 +57,7 @@ context 'with patched warnings' do before do @warnings = warnings = [] - allow_any_instance_of(described_class).to receive(:warn) { |m| warnings << m } + allow(subject).to receive(:warn) { |m| warnings << m } allow(subject).to receive(:after).and_raise(StandardError) end