Skip to content

Commit

Permalink
fix: maintain ruby 2.7 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mhenrixon committed Feb 7, 2024
1 parent 31eebe3 commit 7806089
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/sidekiq_unique_jobs/lock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Lock # rubocop:disable Metrics/ClassLength
#
# @return [Lock] a newly lock that has been locked
#
def self.create(digest, job_id, lock_info = {}, time: Timing.now_f, score: nil)
def self.create(digest, job_id, lock_info: {}, time: Timing.now_f, score: nil)
lock = new(digest, time: time)
lock.lock(job_id, lock_info, score)
lock
Expand Down
4 changes: 2 additions & 2 deletions spec/sidekiq_unique_jobs/lock_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
its(:to_s) { is_expected.to eq(expected_string) }

describe ".create" do
subject(:create) { described_class.create(key, job_id, lock_info) }
subject(:create) { described_class.create(key, job_id, lock_info: lock_info) }

it "creates all expected keys in redis" do
create
Expand Down Expand Up @@ -77,7 +77,7 @@
describe "#del" do
subject(:del) { lock.del }

let(:lock) { described_class.create(key, job_id, info) }
let(:lock) { described_class.create(key, job_id, lock_info: info) }

it "creates keys and adds job_id to locked hash" do
expect { lock }.to change { entity.locked_jids }.to([job_id])
Expand Down
2 changes: 1 addition & 1 deletion spec/sidekiq_unique_jobs/lua/reap_orphans_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
end
let(:argv) { [100, threshold] }
let(:digest) { "uniquejobs:digest" }
let(:lock) { SidekiqUniqueJobs::Lock.create(digest, job_id, lock_info) }
let(:lock) { SidekiqUniqueJobs::Lock.create(digest, job_id, lock_info: lock_info) }
let(:job_id) { "job_id" }
let(:item) { raw_item }
let(:created_at) { (Time.now - 1000).to_f }
Expand Down
4 changes: 2 additions & 2 deletions spec/sidekiq_unique_jobs/orphans/reaper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
let(:digest) { "uniquejobs:digest" }
let(:job_id) { "job_id" }
let(:item) { raw_item }
let(:lock) { SidekiqUniqueJobs::Lock.create(digest, job_id, lock_info, score: score) }
let(:lock) { SidekiqUniqueJobs::Lock.create(digest, job_id, lock_info: lock_info, score: score) }
let(:raw_item) { { "class" => MyUniqueJob, "args" => [], "jid" => job_id, "lock_digest" => digest } }

let(:score) do
Expand Down Expand Up @@ -161,7 +161,7 @@
end

context "when digest has :RUN suffix" do
let(:lock) { SidekiqUniqueJobs::Lock.create("#{digest}:RUN", job_id, lock_info) }
let(:lock) { SidekiqUniqueJobs::Lock.create("#{digest}:RUN", job_id, lock_info: lock_info) }

context "that matches current digest" do # rubocop:disable RSpec/NestedGroups
let(:created_at) { (Time.now - (reaper_timeout + 100)).to_f }
Expand Down
2 changes: 1 addition & 1 deletion spec/sidekiq_unique_jobs/orphans/ruby_reaper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
let(:digest) { "uniquejobs:digest" }
let(:job_id) { "job_id" }
let(:item) { raw_item }
let(:lock) { SidekiqUniqueJobs::Lock.create(digest, job_id, lock_info, score: score) }
let(:lock) { SidekiqUniqueJobs::Lock.create(digest, job_id, lock_info: lock_info, score: score) }
let(:raw_item) { { "class" => MyUniqueJob, "args" => [], "jid" => job_id, "lock_digest" => digest } }
let(:lock_info) do
{
Expand Down

0 comments on commit 7806089

Please sign in to comment.