From 32301601a1824bb7d423b136447ab996a64f0b59 Mon Sep 17 00:00:00 2001 From: Arthur Hess Date: Thu, 7 Nov 2024 15:41:46 -0300 Subject: [PATCH 1/2] Chore: replace references to `OpenStruct` with RSpec doubles --- spec/delayed/backend/test.rb | 1 - spec/rollbar_spec.rb | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) 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 From aa765e702407f12b400b07feba9d29bffd8293f7 Mon Sep 17 00:00:00 2001 From: Arthur Hess Date: Thu, 7 Nov 2024 15:42:14 -0300 Subject: [PATCH 2/2] Chore: remove `OpenStruct` exception from `.rubocop.yml` --- .rubocop.yml | 2 -- 1 file changed, 2 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