Sha256: f36c0bc8065f280cdc59cfc4d86f65174a7f09ec56ab8eadfc9e047ab23899a7
Contents?: true
Size: 1.04 KB
Versions: 7
Compression:
Stored size: 1.04 KB
Contents
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 { QueueBus::Worker.perform(JSON.generate(hash)) }.to raise_error("rider crash") end end end
Version data entries
7 entries across 7 versions & 1 rubygems