diff --git a/lib/sidekiq_unique_jobs/options_with_fallback.rb b/lib/sidekiq_unique_jobs/options_with_fallback.rb index 194e7843d..9cb63ed7f 100644 --- a/lib/sidekiq_unique_jobs/options_with_fallback.rb +++ b/lib/sidekiq_unique_jobs/options_with_fallback.rb @@ -69,17 +69,7 @@ def lock_class # @return [Symbol] # def lock_type - @lock_type ||= options[LOCK] || item[LOCK] || unique_type - end - - # - # @deprecated in favour of {lock_type} - # - # - # @return [Symbol] - # - def unique_type - options[UNIQUE] || item[UNIQUE] + @lock_type ||= options[LOCK] || item[LOCK] end # diff --git a/spec/sidekiq_unique_jobs/middleware/client_spec.rb b/spec/sidekiq_unique_jobs/middleware/client_spec.rb index d4ad7dc70..8ed545688 100644 --- a/spec/sidekiq_unique_jobs/middleware/client_spec.rb +++ b/spec/sidekiq_unique_jobs/middleware/client_spec.rb @@ -82,7 +82,7 @@ end it "does not queue duplicates when when calling delay" do - Array.new(10) { PlainClass.delay(unique: :until_executed, queue: "customqueue").run(1) } + Array.new(10) { PlainClass.delay(lock: :until_executed, queue: "customqueue").run(1) } expect(queue_count("customqueue")).to eq(1) end diff --git a/spec/sidekiq_unique_jobs/options_with_fallback_spec.rb b/spec/sidekiq_unique_jobs/options_with_fallback_spec.rb index 88bab5fa0..6545b9831 100644 --- a/spec/sidekiq_unique_jobs/options_with_fallback_spec.rb +++ b/spec/sidekiq_unique_jobs/options_with_fallback_spec.rb @@ -42,7 +42,7 @@ def initialize(item, options, worker_class = nil) it { is_expected.to eq(nil) } - context 'when options["unique"] is present' do + context 'when options["lock"] is present' do let(:options) { { "lock" => "while_executing" } } let(:item) { { "lock" => "until_executed" } } @@ -57,7 +57,7 @@ def initialize(item, options, worker_class = nil) end end - context 'when item["unique"] is present' do + context 'when item["lock"] is present' do let(:item) { { "lock" => "until_executed" } } it { is_expected.to eq("until_executed") } @@ -80,14 +80,14 @@ def initialize(item, options, worker_class = nil) it { is_expected.to be_truthy } - context 'when options["unique"] is present' do + context 'when options["lock"] is present' do let(:options) { { "lock" => "while_executing" } } let(:item) { { "lock" => "until_executed" } } it { is_expected.to be_falsey } end - context 'when item["unique"] is present' do + context 'when item["lock"] is present' do let(:options) { {} } let(:item) { { "lock" => "until_executed" } } @@ -114,12 +114,12 @@ def initialize(item, options, worker_class = nil) describe "#lock_instance" do subject(:lock) { options_with_fallback.lock_instance } - context 'when item["unique"] is present' do + context 'when item["lock"] is present' do let(:unique) { :until_executed } it { is_expected.to be_a(SidekiqUniqueJobs::Lock::UntilExecuted) } - context 'when options["unique"] is present' do + context 'when options["lock"] is present' do let(:options) { { "lock" => :while_executing } } it { is_expected.to be_a(SidekiqUniqueJobs::Lock::WhileExecuting) } @@ -130,12 +130,12 @@ def initialize(item, options, worker_class = nil) describe "#lock_class" do subject(:lock_class) { options_with_fallback.lock_class } - context 'when item["unique"] is present' do + context 'when item["lock"] is present' do let(:item) { { "lock" => :until_executed } } it { is_expected.to eq(SidekiqUniqueJobs::Lock::UntilExecuted) } - context 'when options["unique"] is present' do + context 'when options["lock"] is present' do let(:options) { { "lock" => :while_executing } } it { is_expected.to eq(SidekiqUniqueJobs::Lock::WhileExecuting) } @@ -156,14 +156,14 @@ def initialize(item, options, worker_class = nil) describe "#lock_type" do subject { options_with_fallback.lock_type } - context 'when options["unique"] is while_executing' do + context 'when options["lock"] is while_executing' do let(:options) { { "lock" => "while_executing" } } let(:item) { { "lock" => "until_executed" } } it { is_expected.to eq("while_executing") } end - context 'when item["unique"] is until_executed' do + context 'when item["lock"] is until_executed' do let(:options) { {} } let(:item) { { "lock" => "until_executed" } }