Sha256: 1b7764847aff8f329df143bc770ef1d50d46a2a907f2567db932aa93d8508698
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 KB
Contents
require 'spec_helper' describe Sidekiq::LimitFetch do before :each do Sidekiq.redis do |it| it.del 'queue:queue1' it.rpush 'queue:queue1', 'task1' it.rpush 'queue:queue1', 'task2' it.expire 'queue:queue1', 30 end end subject { described_class.new options } let(:options) {{ queues: queues, limits: limits, local: local }} let(:queues) { %w(queue1 queue1 queue2 queue2) } let(:limits) {{ 'queue1' => 1, 'queue2' => 2 }} shared_examples_for :strategy do it 'should acquire lock on queue for execution' do work = subject.retrieve_work work.queue_name.should == 'queue1' work.message.should == 'task1' subject.retrieve_work.should_not be work.requeue work = subject.retrieve_work work.message.should == 'task2' subject.retrieve_work.should_not be work.acknowledge work = subject.retrieve_work work.message.should == 'task1' end end context 'global' do let(:local) { false } it_behaves_like :strategy end context 'local' do let(:local) { true } it_behaves_like :strategy end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-limit_fetch-1.6 | spec/sidekiq/limit_fetch_spec.rb |
sidekiq-limit_fetch-1.5 | spec/sidekiq/limit_fetch_spec.rb |