Sha256: 96bb44fcc8bd42f4939436ac18bdf64d4c668fe56e42cf7341122b03e23e6a2b
Contents?: true
Size: 909 Bytes
Versions: 17
Compression:
Stored size: 909 Bytes
Contents
require 'job_uniqueness/spec_helper' RSpec.shared_context "lock strategy specs" do |strategy:| include_context 'with TestWorker' before(:each) { TestWorker.unique_job_options[:strategy] = strategy } let(:context1) { CanvasSync::JobUniqueness::LockContext.new({ jid: 'j1', queue: 'default', job_clazz: 'TestWorker'}) } let(:context2) { CanvasSync::JobUniqueness::LockContext.new({ jid: 'j2', queue: 'default', job_clazz: 'TestWorker'}) } let(:process_one) { described_class.new(context1) } let(:process_two) { described_class.new(context2) } end RSpec.shared_examples "a lock implementation" do it "is unlocked when done" do process_one.on_enqueue {} did_lock = process_one.locked? process_one.on_perform {} did_lock ||= process_one.locked? expect(did_lock).to be_truthy process_one.batch_callback(:success, nil) expect(process_one).not_to be_locked end end
Version data entries
17 entries across 17 versions & 1 rubygems