Sha256: e135a45ba9ca7e64c07cd051a2a0f91ff9c98b78bbd90c132bbaf5568f6954d9

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require "spec_helper"

describe Qe::Qu do
  it "sets adapter when loading file" do
    Qe.adapter = nil
    load "qe/qu.rb"
    expect(Qe.adapter).to eql(Qe::Qu)
  end

  context "worker" do
    it "performs job" do
      Qe::Worker
        .should_receive(:perform)
        .with(:a, :b, :c)

      Qe::Qu::Worker.perform(:a, :b, :c)
    end
  end

  context "enqueuing" do
    let(:worker) {
      mock("worker", :queue => "some_queue", :name => "SomeWorker")
    }

    before do
      Qu.stub :enqueue
    end

    it "sets queue name" do
      Qe::Qu.enqueue(worker)
      expect(Qe::Qu::Worker.instance_variable_get("@queue")).to eql("some_queue")
    end

    it "enqueues job" do
      ::Qu
        .should_receive(:enqueue)
        .with(Qe::Qu::Worker, "SomeWorker", :a => 1)

      Qe::Qu.enqueue(worker, :a => 1)
    end
  end

  context "scheduling" do
    it "raises exception" do
      expect {
        Qe::Qu.schedule(stub, Time.now, :a => 1)
      }.to raise_error(Qe::UnsupportedFeatureError)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qe-0.2.1 spec/qe/qu_spec.rb