Sha256: acd7f7347412003812e5748dfb8673566d8c880d25b680defd05ae1da911db6f

Contents?: true

Size: 862 Bytes

Versions: 1

Compression:

Stored size: 862 Bytes

Contents

require 'delayed_job'
require 'delayed/backend/test'
Delayed::Worker.backend = :test
#require 'delayed_job_active_record'
Delayed::Worker.delay_jobs = false

require 'test_workers'

describe TestWorker do
  it_behaves_like "a worker"
end

describe MultiWorker do
  context "when Delayed::Job is loaded" do
    it "defaults to the :delayed_job adapter" do
      expect(MultiWorker.default_adapter).to eq(:delayed_job)
    end
  end

  context "when using the :delayed_job adapter" do
    it "performs the work using Delayed::Job" do
      expect(TestWorker).to receive(:perform).exactly(3).times.with("foo")
      TestWorker.perform_async("foo")
      MultiWorker.enqueue(TestWorker, "foo")
      TestWorker.perform("foo")
    end

    it "exposes the Delayed Job rake task" do
      expect(MultiWorker.adapter.rake_task.name).to eq("jobs:work")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
multi_worker-0.2.0 spec/adapters/delayed_job_spec.rb