spec/shoryuken/manager_spec.rb in shoryuken-2.1.3 vs spec/shoryuken/manager_spec.rb in shoryuken-3.0.0

- old
+ new

@@ -10,59 +10,49 @@ RSpec.describe Shoryuken::Manager do let(:queue) { 'default' } let(:queues) { [queue] } let(:polling_strategy) { Shoryuken::Polling::WeightedRoundRobin.new(queues) } let(:fetcher) { Shoryuken::Fetcher.new } - let(:condvar) do - condvar = double(:condvar) - allow(condvar).to receive(:signal).and_return(nil) - condvar - end - let(:async_manager) { instance_double(described_class.name) } let(:concurrency) { 1 } - subject { Shoryuken::Manager.new(condvar) } + subject { Shoryuken::Manager.new(fetcher, polling_strategy) } before(:each) do Shoryuken.options[:concurrency] = concurrency - subject.fetcher = fetcher - subject.polling_strategy = polling_strategy - allow_any_instance_of(described_class).to receive(:async).and_return(async_manager) end after(:each) do Shoryuken.options[:concurrency] = 1 TestWorker.get_shoryuken_options['batch'] = false end describe 'Invalid concurrency setting' do it 'raises ArgumentError if concurrency is not positive number' do Shoryuken.options[:concurrency] = -1 - expect { Shoryuken::Manager.new(nil) } + expect { Shoryuken::Manager.new(nil, nil) } .to raise_error(ArgumentError, 'Concurrency value -1 is invalid, it needs to be a positive number') end end - describe '#dispatch' do - it 'pauses when there are no active queues' do + describe '#start' do + xit 'pauses when there are no active queues' do expect(polling_strategy).to receive(:next_queue).and_return(nil) expect_any_instance_of(described_class).to receive(:after) - subject.dispatch + subject.start end - it 'calls dispatch_batch if worker wants batches' do + xit 'calls dispatch_batch if worker wants batches' do TestWorker.get_shoryuken_options['batch'] = true expect_any_instance_of(described_class).to receive(:dispatch_batch).with(queue_config_of(queue)) - expect_any_instance_of(described_class).to receive(:async).and_return(async_manager) - expect(async_manager).to receive(:dispatch) - subject.dispatch + expect(subject).to receive(:dispatch_later) + subject.start end - it 'calls dispatch_single_messages if worker wants single messages' do + xit 'calls dispatch_single_messages if worker wants single messages' do expect_any_instance_of(described_class).to receive(:dispatch_single_messages). with(queue_config_of(queue)) - expect(async_manager).to receive(:dispatch) - subject.dispatch + expect(subject).to receive(:dispatch_later) + subject.start end end describe '#dispatch_batch' do it 'assings batch as a single message' do