Sha256: 13c18828e7d9c5da60e282816d9e4eb6968d0a87289470a892d437696fb2ba9d
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
require 'spec_helper' RSpec.describe SidekiqUniqueJobs::Scripts::ReleaseLock do let(:redis_pool) { nil } let(:jid) { 'abcdefab' } let(:unique_key) { 'uniquejobs:123asdasd2134' } let(:max_lock_time) { 1 } describe '.execute' do subject { instance_double(described_class) } it 'delegates to instance' do expect(described_class).to receive(:new) .with(redis_pool, unique_key, jid) .and_return(subject) expect(subject).to receive(:execute).and_return(true) described_class.execute(redis_pool, unique_key, jid) end end describe '#execute' do context 'when exists' do subject { described_class.execute(redis_pool, unique_key, jid) } before do SidekiqUniqueJobs::Scripts::AcquireLock.execute(redis_pool, unique_key, jid, max_lock_time) end specify do expect(SidekiqUniqueJobs) .to have_key(unique_key) .for_seconds(max_lock_time) .with_value(jid) expect(subject).to eq(true) expect(SidekiqUniqueJobs).not_to have_key(unique_key) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-unique-jobs-5.0.2 | spec/lib/sidekiq_unique_jobs/scripts/release_lock_spec.rb |
sidekiq-unique-jobs-5.0.1 | spec/lib/sidekiq_unique_jobs/scripts/release_lock_spec.rb |