Sha256: 2e22132234a6fe9eea269de1c29adc24898197a17893c78bc33ac115c97c30f7

Contents?: true

Size: 866 Bytes

Versions: 1

Compression:

Stored size: 866 Bytes

Contents

require 'sneakers'
Sneakers.configure(:env => 'test')

require 'test_workers'

describe TestWorker do
  it_behaves_like "a worker"

  it { should be_a ::Sneakers::Worker }
end

describe MultiWorker do
  context "when Sneakers is loaded" do
    it "defaults to the :qu adapter" do
      MultiWorker.default_adapter.should == :sneakers
    end
  end

  context "when using the :sneakers adapter" do
    let(:worker) { TestWorker.new }

    context "when calling #perform_async" do
      it "publishes a message to the queue" do
        expect(::Sneakers).to receive(:publish).once
        worker.perform_async("foo")
      end
    end

    context "when Sneakers calls #work" do
      it "calls #perform" do
        expect(worker).to receive(:perform).once.with("foo")
        worker.work(["foo"].to_json)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
multi_worker-0.1.0 spec/adapters/sneakers_spec.rb