From 11f60a36888b17a83a60624357cfafe3aec0c678 Mon Sep 17 00:00:00 2001 From: Arthur Hess Date: Thu, 7 Nov 2024 16:00:06 -0300 Subject: [PATCH] Remove `OpenStruct` from the project (solve warnings) (#1169) * Chore: replace references to `OpenStruct` with RSpec doubles * Chore: remove `OpenStruct` exception from `.rubocop.yml` --- .rubocop.yml | 2 -- spec/delayed/backend/test.rb | 1 - spec/rollbar_spec.rb | 5 ++--- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 6dcfe055..8d6807f0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -156,8 +156,6 @@ Performance/InefficientHashSearch: Performance/OpenStruct: Enabled: true - Exclude: - - spec/**/* Performance/RangeInclude: Enabled: true diff --git a/spec/delayed/backend/test.rb b/spec/delayed/backend/test.rb index 43c994cd..e02e0956 100644 --- a/spec/delayed/backend/test.rb +++ b/spec/delayed/backend/test.rb @@ -1,4 +1,3 @@ -require 'ostruct' require 'delayed_job' require 'delayed/backend/base' diff --git a/spec/rollbar_spec.rb b/spec/rollbar_spec.rb index 6f84fe7a..447b30b0 100644 --- a/spec/rollbar_spec.rb +++ b/spec/rollbar_spec.rb @@ -7,7 +7,6 @@ require 'active_support/json/encoding' require 'rollbar/item' -require 'ostruct' require 'spec_helper' @@ -242,7 +241,7 @@ notifier.configuration = configuration allow_any_instance_of(Net::HTTP) .to receive(:request) - .and_return(OpenStruct.new(:code => 500, :body => 'Error')) + .and_return(double(code: 500, body: 'Error')) @uri = URI.parse(Rollbar::Configuration::DEFAULT_ENDPOINT) end @@ -1518,7 +1517,7 @@ def backtrace before do allow_any_instance_of(Net::HTTP) .to receive(:request) - .and_return(OpenStruct.new(:code => 200, :body => 'Success')) + .and_return(double(code: 200, body: 'Success')) @env_vars = clear_proxy_env_vars end