From 9d7c1ac540937b5901cbd0410bfbc8dc51a180d8 Mon Sep 17 00:00:00 2001 From: mhenrixon Date: Fri, 25 Nov 2022 15:12:36 +0100 Subject: [PATCH 1/9] fix: consistent digests --- lib/sidekiq_unique_jobs/lock_digest.rb | 2 +- sidekiq-unique-jobs.gemspec | 2 +- spec/sidekiq/api_spec.rb | 2 +- spec/sidekiq_unique_jobs/digests_spec.rb | 22 +++++++++---------- spec/sidekiq_unique_jobs/job_spec.rb | 2 +- .../middleware/client_spec.rb | 2 +- .../middleware/server_spec.rb | 3 +-- 7 files changed, 17 insertions(+), 18 deletions(-) diff --git a/lib/sidekiq_unique_jobs/lock_digest.rb b/lib/sidekiq_unique_jobs/lock_digest.rb index c89c3cb86..c81ec76ea 100644 --- a/lib/sidekiq_unique_jobs/lock_digest.rb +++ b/lib/sidekiq_unique_jobs/lock_digest.rb @@ -51,7 +51,7 @@ def lock_digest # Creates a namespaced unique digest based on the {#digestable_hash} and the {#lock_prefix} # @return [String] a unique digest def create_digest - digest = OpenSSL::Digest::MD5.hexdigest(dump_json(digestable_hash)) + digest = OpenSSL::Digest::MD5.hexdigest(dump_json(digestable_hash.sort)) "#{lock_prefix}:#{digest}" end diff --git a/sidekiq-unique-jobs.gemspec b/sidekiq-unique-jobs.gemspec index 2d2733098..04e83d162 100644 --- a/sidekiq-unique-jobs.gemspec +++ b/sidekiq-unique-jobs.gemspec @@ -73,7 +73,7 @@ Gem::Specification.new do |spec| spec.add_dependency "brpoplpush-redis_script", "> 0.1.1", "<= 2.0.0" spec.add_dependency "concurrent-ruby", "~> 1.0", ">= 1.0.5" - spec.add_dependency "sidekiq", ">= 5.0", "< 8.0" + spec.add_dependency "sidekiq", ">= 5.0", "< 7.0" spec.add_dependency "thor", ">= 0.20", "< 3.0" spec.metadata = { "rubygems_mfa_required" => "true", diff --git a/spec/sidekiq/api_spec.rb b/spec/sidekiq/api_spec.rb index e6fdf8777..8217e5293 100644 --- a/spec/sidekiq/api_spec.rb +++ b/spec/sidekiq/api_spec.rb @@ -6,7 +6,7 @@ "queue" => "testqueue", "args" => [{ foo: "bar" }] } end - let(:lock_digest) { "uniquejobs:577db3c4fc72230bf2c256faa708a083" } + let(:lock_digest) { "uniquejobs:1fa0458e74c76c7029b1f4f00bc59ec9" } let(:key) { SidekiqUniqueJobs::Key.new(lock_digest) } describe Sidekiq::SortedEntry::UniqueExtension do diff --git a/spec/sidekiq_unique_jobs/digests_spec.rb b/spec/sidekiq_unique_jobs/digests_spec.rb index 239293f77..1e5368413 100644 --- a/spec/sidekiq_unique_jobs/digests_spec.rb +++ b/spec/sidekiq_unique_jobs/digests_spec.rb @@ -6,16 +6,16 @@ shared_context "with a regular job" do let(:expected_keys) do { - "uniquejobs:0781b1f587a9a8d08773f21ed752caed" => kind_of(Float), - "uniquejobs:09b3a42f77a75865bf27ac44e66bb4ef" => kind_of(Float), - "uniquejobs:1c4c0bf2a8a1006c7610e4ef1f965f34" => kind_of(Float), - "uniquejobs:236feda848cfbb1ae32d4d9af666349e" => kind_of(Float), - "uniquejobs:77d1e23f18943bc048b48a01b85af0b3" => kind_of(Float), - "uniquejobs:9fcaaf3e873f101a8d79e00e89bb3b36" => kind_of(Float), - "uniquejobs:a47040c19b3741eaf912a96cd8bee728" => kind_of(Float), - "uniquejobs:c85f45d715232cfff0505fb85ca92659" => kind_of(Float), - "uniquejobs:cb5be91a66b83435281c23fe489f22b5" => kind_of(Float), - "uniquejobs:e74bebbf569d620397688fded62c85d6" => kind_of(Float), + "uniquejobs:191cc66e8db74a712ca80180d846a8c0" => kind_of(Float), + "uniquejobs:70091c2e18d6b45cd1a257a7b77c1dc0" => kind_of(Float), + "uniquejobs:72254d80583af0f3cf1ff3cd8271c532" => kind_of(Float), + "uniquejobs:7f1a663f444e9629ed73893541564351" => kind_of(Float), + "uniquejobs:a1d714a6dacd9fcfe0aa6274af3d5ab4" => kind_of(Float), + "uniquejobs:b9d8a7667ef91f07e9c5a735e08e0891" => kind_of(Float), + "uniquejobs:ced55fba57e2d67b2422cacbe08896f4" => kind_of(Float), + "uniquejobs:e284198d560db35309c4d1b49e325645" => kind_of(Float), + "uniquejobs:e3544c3ca5a5b28141a1d161c70d04cb" => kind_of(Float), + "uniquejobs:eb82e9e8057a8912a3f970c8768975f7" => kind_of(Float), } end @@ -73,7 +73,7 @@ context "with a regular job" do include_context "with a regular job" - let(:digest) { "uniquejobs:e74bebbf569d620397688fded62c85d6" } + let(:digest) { "uniquejobs:a1d714a6dacd9fcfe0aa6274af3d5ab4" } before do allow(digests).to receive(:log_info) diff --git a/spec/sidekiq_unique_jobs/job_spec.rb b/spec/sidekiq_unique_jobs/job_spec.rb index 70bf2de30..7f27c2898 100644 --- a/spec/sidekiq_unique_jobs/job_spec.rb +++ b/spec/sidekiq_unique_jobs/job_spec.rb @@ -24,7 +24,7 @@ "lock_timeout" => MyUniqueJob.get_sidekiq_options["lock_timeout"].to_i, "lock_ttl" => MyUniqueJob.get_sidekiq_options["lock_ttl"], "lock_args" => args, - "lock_digest" => "uniquejobs:149ef752a5776e0bd05929b8f0e33250", + "lock_digest" => "uniquejobs:6b6835a019cad7c2a7a4e53e20a9184c", "lock_prefix" => "uniquejobs", }, ) diff --git a/spec/sidekiq_unique_jobs/middleware/client_spec.rb b/spec/sidekiq_unique_jobs/middleware/client_spec.rb index fd91288e5..6775c84b3 100644 --- a/spec/sidekiq_unique_jobs/middleware/client_spec.rb +++ b/spec/sidekiq_unique_jobs/middleware/client_spec.rb @@ -9,7 +9,7 @@ expect(schedule_count).to eq(1) expected = %w[ - uniquejobs:26a33855311a0a653c5e0b4af1d1458d + uniquejobs:ae503400be25bde0465cebd14f6f0daf ] expect(keys).to include(*expected) diff --git a/spec/sidekiq_unique_jobs/middleware/server_spec.rb b/spec/sidekiq_unique_jobs/middleware/server_spec.rb index 890aec070..e5c985cc1 100644 --- a/spec/sidekiq_unique_jobs/middleware/server_spec.rb +++ b/spec/sidekiq_unique_jobs/middleware/server_spec.rb @@ -10,8 +10,7 @@ it "does not unlock keys it does not own" do jid = UntilExecutedJob.perform_async item = Sidekiq::Queue.new(queue).find_job(jid).item - - digest = "uniquejobs:cf51f14f752c9ca8f3cfb0bbebad4abc" + digest = "uniquejobs:41459093fde370420ea1d1f446b60281" expect(get(digest)).to eq(jid) set(digest, "NOT_DELETED") From d1e97113648e418fc70d4b0ab6ddb47f4e1762f7 Mon Sep 17 00:00:00 2001 From: mhenrixon Date: Fri, 25 Nov 2022 15:14:16 +0100 Subject: [PATCH 2/9] chore(lint): lint'em real good --- myapp/spec/models/post_spec.rb | 7 ------- myapp/spec/models/user_spec.rb | 7 ------- spec/sidekiq_unique_jobs/lock/base_lock_spec.rb | 5 +---- 3 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 myapp/spec/models/post_spec.rb delete mode 100644 myapp/spec/models/user_spec.rb diff --git a/myapp/spec/models/post_spec.rb b/myapp/spec/models/post_spec.rb deleted file mode 100644 index 16fbd7400..000000000 --- a/myapp/spec/models/post_spec.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -require "rails_helper" - -describe Post, type: :model do - it { "behaves" } -end diff --git a/myapp/spec/models/user_spec.rb b/myapp/spec/models/user_spec.rb deleted file mode 100644 index 47d6a3650..000000000 --- a/myapp/spec/models/user_spec.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -require "rails_helper" - -RSpec.describe User, type: :model do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/sidekiq_unique_jobs/lock/base_lock_spec.rb b/spec/sidekiq_unique_jobs/lock/base_lock_spec.rb index 05cab9faf..05b81c686 100644 --- a/spec/sidekiq_unique_jobs/lock/base_lock_spec.rb +++ b/spec/sidekiq_unique_jobs/lock/base_lock_spec.rb @@ -33,10 +33,7 @@ allow(lock).to receive(:reflect) end - it "reflects" do - end - - it "logs a warning" do + it "reflects a warning" do expect { callback_safely }.to raise_error(RuntimeError, "Hell") expect(lock).to have_received(:reflect).with(:after_unlock_callback_failed, item) end From f33c0f1683b4ceb36efe0baed2e34e24617d62ca Mon Sep 17 00:00:00 2001 From: mhenrixon Date: Fri, 25 Nov 2022 15:22:36 +0100 Subject: [PATCH 3/9] fix(redis): silence deprecations --- spec/sidekiq_unique_jobs/lua/reap_orphans_spec.rb | 2 +- spec/sidekiq_unique_jobs/orphans/reaper_spec.rb | 2 +- spec/sidekiq_unique_jobs/upgrade_locks_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/sidekiq_unique_jobs/lua/reap_orphans_spec.rb b/spec/sidekiq_unique_jobs/lua/reap_orphans_spec.rb index 9a5c9d800..8ba24d47b 100644 --- a/spec/sidekiq_unique_jobs/lua/reap_orphans_spec.rb +++ b/spec/sidekiq_unique_jobs/lua/reap_orphans_spec.rb @@ -129,7 +129,7 @@ before do SidekiqUniqueJobs.redis do |conn| conn.multi do |pipeline| - pipeline.sadd("processes", process_key) + pipeline.sadd?("processes", process_key) pipeline.hset(worker_key, thread_id, dump_json(item)) pipeline.expire(process_key, 60) pipeline.expire(worker_key, 60) diff --git a/spec/sidekiq_unique_jobs/orphans/reaper_spec.rb b/spec/sidekiq_unique_jobs/orphans/reaper_spec.rb index 11e7d7669..cdf131273 100644 --- a/spec/sidekiq_unique_jobs/orphans/reaper_spec.rb +++ b/spec/sidekiq_unique_jobs/orphans/reaper_spec.rb @@ -138,7 +138,7 @@ before do SidekiqUniqueJobs.redis do |conn| conn.multi do |pipeline| - pipeline.sadd("processes", process_key) + pipeline.sadd?("processes", process_key) pipeline.set(process_key, "bogus") pipeline.hset(worker_key, thread_id, dump_json(payload: item.merge(created_at: created_at))) pipeline.expire(process_key, 60) diff --git a/spec/sidekiq_unique_jobs/upgrade_locks_spec.rb b/spec/sidekiq_unique_jobs/upgrade_locks_spec.rb index 77049c1ac..ff54258fa 100644 --- a/spec/sidekiq_unique_jobs/upgrade_locks_spec.rb +++ b/spec/sidekiq_unique_jobs/upgrade_locks_spec.rb @@ -13,7 +13,7 @@ conn.pipelined do |pipeline| chunk.each do |digest| job_id = SecureRandom.hex(12) - pipeline.sadd("unique:keys", digest) + pipeline.sadd?("unique:keys", digest) pipeline.set("#{digest}:EXISTS", job_id) pipeline.rpush("#{digest}:AVAILABLE", digest) pipeline.hset("#{digest}:GRABBED", job_id, now_f) From 38e377f5a44091bdfa3b5388b04d71e1d66dacc0 Mon Sep 17 00:00:00 2001 From: mhenrixon Date: Fri, 25 Nov 2022 15:24:06 +0100 Subject: [PATCH 4/9] fix(spec): another wrong digest --- spec/sidekiq_unique_jobs/on_conflict/replace_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/sidekiq_unique_jobs/on_conflict/replace_spec.rb b/spec/sidekiq_unique_jobs/on_conflict/replace_spec.rb index 33d26fc1a..9df1e6a89 100644 --- a/spec/sidekiq_unique_jobs/on_conflict/replace_spec.rb +++ b/spec/sidekiq_unique_jobs/on_conflict/replace_spec.rb @@ -2,7 +2,7 @@ RSpec.describe SidekiqUniqueJobs::OnConflict::Replace do let(:strategy) { described_class.new(item) } - let(:lock_digest) { "uniquejobs:0781b1f587a9a8d08773f21ed752caed" } + let(:lock_digest) { "uniquejobs:a1d714a6dacd9fcfe0aa6274af3d5ab4" } let(:block) { -> { p "Hello" } } let(:digest) { digests.entries.first } From fadf0cd7c51851ea2d94a22d2db78a850989c803 Mon Sep 17 00:00:00 2001 From: mhenrixon Date: Fri, 25 Nov 2022 21:39:24 +0100 Subject: [PATCH 5/9] chore(deps): ignore sidekiq develop for now --- Appraisals | 6 +++--- gemfiles/sidekiq_develop.gemfile | 29 ----------------------------- 2 files changed, 3 insertions(+), 32 deletions(-) delete mode 100644 gemfiles/sidekiq_develop.gemfile diff --git a/Appraisals b/Appraisals index 9c4dd2d9f..75315e6bd 100644 --- a/Appraisals +++ b/Appraisals @@ -1,8 +1,8 @@ # frozen_string_literal: true -appraise "sidekiq-develop" do - gem "sidekiq", git: "https://github.com/mperham/sidekiq.git" -end +# appraise "sidekiq-develop" do +# gem "sidekiq", git: "https://github.com/mperham/sidekiq.git" +# end appraise "sidekiq-5.0" do gem "sidekiq", "~> 5.0.0" diff --git a/gemfiles/sidekiq_develop.gemfile b/gemfiles/sidekiq_develop.gemfile deleted file mode 100644 index c1d31c9ba..000000000 --- a/gemfiles/sidekiq_develop.gemfile +++ /dev/null @@ -1,29 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "appraisal" -gem "gem-release" -gem "github-markup" -gem "rack-test" -gem "rake", "13.0.3" -gem "redis-namespace" -gem "reek", ">= 5.3" -gem "rspec" -gem "rspec-benchmark" -gem "rspec-html-matchers" -gem "rspec-its" -gem "rubocop-mhenrixon" -gem "simplecov-sublime", ">= 0.21.2", require: false -gem "sinatra" -gem "timecop" -gem "toxiproxy" -gem "yard" -gem "sidekiq", git: "https://github.com/mperham/sidekiq.git" - -platforms :mri do - gem "concurrent-ruby-ext" - gem "hiredis" -end - -gemspec path: "../" From 083b2a0140cbad24b4d95ce1976816a204db4c0e Mon Sep 17 00:00:00 2001 From: mhenrixon Date: Fri, 25 Nov 2022 21:43:24 +0100 Subject: [PATCH 6/9] chore(deps): stupid compatibility --- spec/sidekiq_unique_jobs/lua/reap_orphans_spec.rb | 6 +++++- spec/sidekiq_unique_jobs/orphans/reaper_spec.rb | 6 +++++- spec/sidekiq_unique_jobs/upgrade_locks_spec.rb | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/spec/sidekiq_unique_jobs/lua/reap_orphans_spec.rb b/spec/sidekiq_unique_jobs/lua/reap_orphans_spec.rb index 8ba24d47b..0d0e0a265 100644 --- a/spec/sidekiq_unique_jobs/lua/reap_orphans_spec.rb +++ b/spec/sidekiq_unique_jobs/lua/reap_orphans_spec.rb @@ -129,7 +129,11 @@ before do SidekiqUniqueJobs.redis do |conn| conn.multi do |pipeline| - pipeline.sadd?("processes", process_key) + if pipeline.respond_to?(:sadd?) + pipeline.sadd?("processes", process_key) + else + pipeline.sadd("processes", process_key) + end pipeline.hset(worker_key, thread_id, dump_json(item)) pipeline.expire(process_key, 60) pipeline.expire(worker_key, 60) diff --git a/spec/sidekiq_unique_jobs/orphans/reaper_spec.rb b/spec/sidekiq_unique_jobs/orphans/reaper_spec.rb index cdf131273..30440a713 100644 --- a/spec/sidekiq_unique_jobs/orphans/reaper_spec.rb +++ b/spec/sidekiq_unique_jobs/orphans/reaper_spec.rb @@ -138,7 +138,11 @@ before do SidekiqUniqueJobs.redis do |conn| conn.multi do |pipeline| - pipeline.sadd?("processes", process_key) + if pipeline.respond_to?(:sadd?) + pipeline.sadd?("processes", process_key) + else + pipeline.sadd("processes", process_key) + end pipeline.set(process_key, "bogus") pipeline.hset(worker_key, thread_id, dump_json(payload: item.merge(created_at: created_at))) pipeline.expire(process_key, 60) diff --git a/spec/sidekiq_unique_jobs/upgrade_locks_spec.rb b/spec/sidekiq_unique_jobs/upgrade_locks_spec.rb index ff54258fa..ac0d1da99 100644 --- a/spec/sidekiq_unique_jobs/upgrade_locks_spec.rb +++ b/spec/sidekiq_unique_jobs/upgrade_locks_spec.rb @@ -13,7 +13,11 @@ conn.pipelined do |pipeline| chunk.each do |digest| job_id = SecureRandom.hex(12) - pipeline.sadd?("unique:keys", digest) + if pipeline.respond_to?(:sadd?) + pipeline.sadd?("unique:keys", digest) + else + pipeline.sadd("unique:keys", digest) + end pipeline.set("#{digest}:EXISTS", job_id) pipeline.rpush("#{digest}:AVAILABLE", digest) pipeline.hset("#{digest}:GRABBED", job_id, now_f) From 7e50bf56f08c142d56a71ebce4926016942730cd Mon Sep 17 00:00:00 2001 From: mhenrixon Date: Fri, 25 Nov 2022 21:47:22 +0100 Subject: [PATCH 7/9] fix(redis): use the ruby driver --- spec/spec_helper.rb | 8 ++++---- spec/support/sidekiq_unique_jobs/testing.rb | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f16ad76dd..998c02bcd 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -39,7 +39,7 @@ end Sidekiq.configure_server do |config| - config.redis = { port: 6379, driver: :hiredis } + config.redis = { port: 6379 } config.server_middleware do |chain| chain.add SidekiqUniqueJobs::Middleware::Server @@ -53,7 +53,7 @@ end Sidekiq.configure_client do |config| - config.redis = { port: 6379, driver: :hiredis } + config.redis = { port: 6379 } config.client_middleware do |chain| chain.add SidekiqUniqueJobs::Middleware::Client @@ -109,11 +109,11 @@ config.before do Sidekiq.configure_server do |conf| - conf.redis = { port: 6379, driver: :hiredis } + conf.redis = { port: 6379 } end Sidekiq.configure_client do |conf| - conf.redis = { port: 6379, driver: :hiredis } + conf.redis = { port: 6379 } end end diff --git a/spec/support/sidekiq_unique_jobs/testing.rb b/spec/support/sidekiq_unique_jobs/testing.rb index a3b03411c..8b21dbc49 100644 --- a/spec/support/sidekiq_unique_jobs/testing.rb +++ b/spec/support/sidekiq_unique_jobs/testing.rb @@ -372,7 +372,13 @@ def scard(key) end def sadd(key, member) - redis { |conn| conn.sadd(key, member) } + redis do |conn| + if conn.respond_to?(:sadd?) + conn.sadd?(key, member) + else + conn.sadd(key, member) + end + end end def srem(key, member) From a652ca9e381a9d6b48c2b44367f61cc864f42d54 Mon Sep 17 00:00:00 2001 From: mhenrixon Date: Sat, 3 Dec 2022 10:36:27 +0100 Subject: [PATCH 8/9] chore(deps): lock redis to < 5.0 --- .fasterer.yml | 3 +++ .rubocop.yml | 4 ++-- sidekiq-unique-jobs.gemspec | 1 + spec/sidekiq_unique_jobs/on_conflict/reject_spec.rb | 2 +- spec/sidekiq_unique_jobs/sidekiq_worker_methods_spec.rb | 1 + 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.fasterer.yml b/.fasterer.yml index 0252c7c30..854726be9 100644 --- a/.fasterer.yml +++ b/.fasterer.yml @@ -21,3 +21,6 @@ speedups: exclude_paths: - 'spec/**/*.rb' + - 'vendor/**/*.rb' + - 'gemfiles/**/*.rb' + diff --git a/.rubocop.yml b/.rubocop.yml index bc9209e0d..defbcd144 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -21,8 +21,8 @@ Layout/LineLength: - myapp/db/**/*.rb - myapp/config/initializers/devise.rb -Layout/LineContinuationLeadingSpace: - Enabled: false +# Layout/LineContinuationLeadingSpace: +# Enabled: false Lint/AmbiguousBlockAssociation: Exclude: diff --git a/sidekiq-unique-jobs.gemspec b/sidekiq-unique-jobs.gemspec index 04e83d162..7a19acbe8 100644 --- a/sidekiq-unique-jobs.gemspec +++ b/sidekiq-unique-jobs.gemspec @@ -73,6 +73,7 @@ Gem::Specification.new do |spec| spec.add_dependency "brpoplpush-redis_script", "> 0.1.1", "<= 2.0.0" spec.add_dependency "concurrent-ruby", "~> 1.0", ">= 1.0.5" + spec.add_dependency "redis", "< 5.0" spec.add_dependency "sidekiq", ">= 5.0", "< 7.0" spec.add_dependency "thor", ">= 0.20", "< 3.0" spec.metadata = { diff --git a/spec/sidekiq_unique_jobs/on_conflict/reject_spec.rb b/spec/sidekiq_unique_jobs/on_conflict/reject_spec.rb index 214a50505..04f73947d 100644 --- a/spec/sidekiq_unique_jobs/on_conflict/reject_spec.rb +++ b/spec/sidekiq_unique_jobs/on_conflict/reject_spec.rb @@ -4,7 +4,7 @@ include_context "with a stubbed locksmith" let(:strategy) { described_class.new(item) } let(:deadset) { instance_spy(Sidekiq::DeadSet) } - let(:payload) { instance_spy("payload") } # rubocop:disable RSpec/VerifiedDoubleReference + let(:payload) { instance_spy("payload") } let(:item) do { "jid" => "maaaahjid", "class" => "WhileExecutingRejectJob", diff --git a/spec/sidekiq_unique_jobs/sidekiq_worker_methods_spec.rb b/spec/sidekiq_unique_jobs/sidekiq_worker_methods_spec.rb index 4f9f7773b..489deb8ed 100644 --- a/spec/sidekiq_unique_jobs/sidekiq_worker_methods_spec.rb +++ b/spec/sidekiq_unique_jobs/sidekiq_worker_methods_spec.rb @@ -45,6 +45,7 @@ def initialize(job_class) let(:error_message) { "this class does not exist" } before do + allow(Object).to receive(:const_get).and_call_original allow(Object).to receive(:const_get) .with(job_class) .and_raise(NameError, error_message) From 5f605428bab13e82283c85034530bfda51c787e3 Mon Sep 17 00:00:00 2001 From: mhenrixon Date: Sat, 3 Dec 2022 10:44:28 +0100 Subject: [PATCH 9/9] chore(lint): lint'em real good --- .rubocop.yml | 4 ++-- spec/sidekiq_unique_jobs/on_conflict/reject_spec.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index defbcd144..bc9209e0d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -21,8 +21,8 @@ Layout/LineLength: - myapp/db/**/*.rb - myapp/config/initializers/devise.rb -# Layout/LineContinuationLeadingSpace: -# Enabled: false +Layout/LineContinuationLeadingSpace: + Enabled: false Lint/AmbiguousBlockAssociation: Exclude: diff --git a/spec/sidekiq_unique_jobs/on_conflict/reject_spec.rb b/spec/sidekiq_unique_jobs/on_conflict/reject_spec.rb index 04f73947d..2d18938d6 100644 --- a/spec/sidekiq_unique_jobs/on_conflict/reject_spec.rb +++ b/spec/sidekiq_unique_jobs/on_conflict/reject_spec.rb @@ -4,7 +4,7 @@ include_context "with a stubbed locksmith" let(:strategy) { described_class.new(item) } let(:deadset) { instance_spy(Sidekiq::DeadSet) } - let(:payload) { instance_spy("payload") } + let(:payload) { instance_spy(String) } let(:item) do { "jid" => "maaaahjid", "class" => "WhileExecutingRejectJob",