Sha256: cef4497387ec702cb45d7defcf29551bce573f49015dbc86eabcbe9b9fbd0dec

Contents?: true

Size: 883 Bytes

Versions: 1

Compression:

Stored size: 883 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
      MultiWorker.default_adapter.should == :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
      MultiWorker.adapter.rake_task.name.should == "jobs:work"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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