Sha256: be10f91660515646f0cfe9ce23c844642899bb01966a8bb17165ddb3f1fcfac7
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true require 'spec_helper' module QueueBus describe Worker do it 'should proxy to given class' do hash = { 'bus_class_proxy' => 'QueueBus::Driver', 'ok' => true } expect(QueueBus::Driver).to receive(:perform).with(hash) QueueBus::Worker.perform(JSON.generate(hash)) end it 'should use instance' do hash = { 'bus_class_proxy' => 'QueueBus::Rider', 'ok' => true } expect(QueueBus::Rider).to receive(:perform).with(hash) QueueBus::Worker.new.perform(JSON.generate(hash)) end it 'should not freak out if class not there anymore' do hash = { 'bus_class_proxy' => 'QueueBus::BadClass', 'ok' => true } expect(QueueBus::Worker.perform(JSON.generate(hash))).to eq(nil) end it 'should raise error if proxy raises error' do hash = { 'bus_class_proxy' => 'QueueBus::Rider', 'ok' => true } expect(QueueBus::Rider).to receive(:perform).with(hash).and_raise('rider crash') expect do QueueBus::Worker.perform(JSON.generate(hash)) end.to raise_error('rider crash') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-bus-0.9.0 | spec/worker_spec.rb |
sidekiq-bus-0.8.2 | spec/worker_spec.rb |