Sha256: a7ded18b4ba222a3a65c6f1d45eb08c73915b03b5c3cc5e60ac3b481aef386c8

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 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) {
      double("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(double, Time.now, :a => 1)
      }.to raise_error(Qe::UnsupportedFeatureError)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
qe-0.3.4 spec/qe/qu_spec.rb
qe-0.3.3 spec/qe/qu_spec.rb
qe-0.3.2 spec/qe/qu_spec.rb
qe-0.3.1 spec/qe/qu_spec.rb
qe-0.3.0 spec/qe/qu_spec.rb