Sha256: bef78e89b1709fde50c2b95a1f7090fd4fc399bf55742a83dbba2ab09a200b93

Contents?: true

Size: 833 Bytes

Versions: 1

Compression:

Stored size: 833 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
      expect(MultiWorker.default_adapter).to eq(: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.2.0 spec/adapters/sneakers_spec.rb