Sha256: e8efb1d3397680b0f657110a9c2b93d41d4cc8ed7ed0fcf309e559359a34f81b

Contents?: true

Size: 1.04 KB

Versions: 21

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}
      QueueBus::Driver.should_receive(:perform).with(hash)
      QueueBus::Worker.perform(JSON.generate(hash))
    end

    it "should use instance" do
      hash = {"bus_class_proxy" => "QueueBus::Rider", "ok" => true}
      QueueBus::Rider.should_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}
      lambda {
        QueueBus::Worker.perform(JSON.generate(hash))
      }.should_not raise_error
    end

    it "should raise error if proxy raises error" do
      hash = {"bus_class_proxy" => "QueueBus::Rider", "ok" => true}
      QueueBus::Rider.should_receive(:perform).with(hash).and_raise("rider crash")
      lambda {
        QueueBus::Worker.perform(JSON.generate(hash))
      }.should raise_error
    end
  end
end

Version data entries

21 entries across 21 versions & 3 rubygems

Version Path
resque-bus-0.7.0 spec/worker_spec.rb
resque-bus-0.6.1 spec/worker_spec.rb
resque-bus-0.6.0 spec/worker_spec.rb
resque-bus-0.5.12 spec/worker_spec.rb
queue-bus-0.5.9 spec/worker_spec.rb
resque-bus-0.5.11 spec/worker_spec.rb
queue-bus-0.5.8 spec/worker_spec.rb
resque-bus-0.5.10 spec/worker_spec.rb
queue-bus-0.5.7 spec/worker_spec.rb
sidekiq-bus-0.5.5 spec/worker_spec.rb
resque-bus-0.5.9 spec/worker_spec.rb
sidekiq-bus-0.5.4 spec/worker_spec.rb
resque-bus-0.5.8 spec/worker_spec.rb
queue-bus-0.5.6 spec/worker_spec.rb
resque-bus-0.5.7 spec/worker_spec.rb
queue-bus-0.5.5 spec/worker_spec.rb
sidekiq-bus-0.5.3 spec/worker_spec.rb
queue-bus-0.5.4 spec/worker_spec.rb
queue-bus-0.5.3 spec/worker_spec.rb
sidekiq-bus-0.5.2 spec/worker_spec.rb