From 61c91b0e3c5e8d9b25970c11e5540f9f248d6cf2 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Tue, 26 Nov 2024 04:34:48 +0700 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Fix=20spelling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sidekiq/helpers/within_sidekiq_retries_exhausted_block.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rspec/sidekiq/helpers/within_sidekiq_retries_exhausted_block.rb b/lib/rspec/sidekiq/helpers/within_sidekiq_retries_exhausted_block.rb index 30e8eec..f9d7820 100644 --- a/lib/rspec/sidekiq/helpers/within_sidekiq_retries_exhausted_block.rb +++ b/lib/rspec/sidekiq/helpers/within_sidekiq_retries_exhausted_block.rb @@ -13,12 +13,12 @@ def default_retries_exhausted_message 'queue' => get_sidekiq_options[:worker], 'class' => name, 'args' => [], - 'error_message' => 'An error occured' + 'error_message' => 'An error occurred' } end def default_retries_exhausted_exception - StandardError.new('An error occured') + StandardError.new('An error occurred') end end end From d1296145195de6dfd4f9b89401be6dc97628148c Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Tue, 26 Nov 2024 04:37:13 +0700 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=9B=20Queue=20always=20nil=20in=20?= =?UTF-8?q?default=5Fretries=5Fexhausted=5Fmessage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - worker is no longer used in most scenarios - See: https://github.com/sidekiq/sidekiq/wiki/Best-Practices#4-use-precise-terminology - keys are string, symbol lookups fail - Add test --- .../helpers/within_sidekiq_retries_exhausted_block.rb | 2 +- spec/rspec/sidekiq/helpers/retries_exhausted_spec.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/rspec/sidekiq/helpers/within_sidekiq_retries_exhausted_block.rb b/lib/rspec/sidekiq/helpers/within_sidekiq_retries_exhausted_block.rb index f9d7820..d27b41b 100644 --- a/lib/rspec/sidekiq/helpers/within_sidekiq_retries_exhausted_block.rb +++ b/lib/rspec/sidekiq/helpers/within_sidekiq_retries_exhausted_block.rb @@ -10,7 +10,7 @@ def within_sidekiq_retries_exhausted_block(user_msg = {}, exception = default_re def default_retries_exhausted_message { - 'queue' => get_sidekiq_options[:worker], + 'queue' => get_sidekiq_options['queue'], 'class' => name, 'args' => [], 'error_message' => 'An error occurred' diff --git a/spec/rspec/sidekiq/helpers/retries_exhausted_spec.rb b/spec/rspec/sidekiq/helpers/retries_exhausted_spec.rb index 7e4811d..26cc2dc 100644 --- a/spec/rspec/sidekiq/helpers/retries_exhausted_spec.rb +++ b/spec/rspec/sidekiq/helpers/retries_exhausted_spec.rb @@ -20,6 +20,15 @@ def self.baz(exception) end end + it 'has an exhausted message' do + expect(FooClass.default_retries_exhausted_message).to eq({ + "args" => [], + "class" => "FooClass", + "error_message" => "An error occurred", + "queue" => "data", + }) + end + it 'executes whatever is within the block' do FooClass.within_sidekiq_retries_exhausted_block { expect(FooClass).to receive(:bar).with('hello') } end