Sha256: 58ecf76443609e7764aa238b62fd556775658f7f7a24e5c7593fa66368dc08aa
Contents?: true
Size: 1.51 KB
Versions: 15
Compression:
Stored size: 1.51 KB
Contents
require 'job_uniqueness/spec_helper' RSpec.describe CanvasSync::JobUniqueness::UniqueJobCommon do describe ".unlock!" do include_context "with TestWorker" it "unlocks the lock with a specific JID" do jid = TestWorker.perform_async lctx = CanvasSync::JobUniqueness::LockContext.new({ jid: jid, queue: 'default', job_clazz: 'TestWorker'}) lstrat = lctx.lock_strategy lsmith = lstrat.send(:locksmith) expect(lsmith.locked?).to be_truthy TestWorker.unlock!(jid, queue: 'default') expect(lsmith.locked?).to be_falsey end it "unlocks the lock without a specific JID" do jid = TestWorker.perform_async lctx = CanvasSync::JobUniqueness::LockContext.new({ jid: jid, queue: 'default', job_clazz: 'TestWorker'}) lstrat = lctx.lock_strategy lsmith = lstrat.send(:locksmith) expect(lsmith.locked?).to be_truthy TestWorker.unlock!(queue: 'default') expect(lsmith.locked?).to be_falsey end it "unlocks the lock matching parameters" do args = [1, 2, 3] jid = TestWorker.perform_async(*args) lctx = CanvasSync::JobUniqueness::LockContext.new({ jid: jid, queue: 'default', job_clazz: 'TestWorker', args: args}) lstrat = lctx.lock_strategy lsmith = lstrat.send(:locksmith) expect(lsmith.locked?).to be_truthy TestWorker.unlock!(queue: 'default') expect(lsmith.locked?).to be_truthy TestWorker.unlock!(queue: 'default', args: args) expect(lsmith.locked?).to be_falsey end end end
Version data entries
15 entries across 15 versions & 1 rubygems