Sha256: 7ded55fc30c0f0e79245b624ff42d7aff60436750cfc29ea0cdffceb593a812c

Contents?: true

Size: 890 Bytes

Versions: 67

Compression:

Stored size: 890 Bytes

Contents

module Ddr::Jobs
  RSpec.describe Job do

    before(:all) do
      class TestJob
        extend Job

        @queue = :test

        def perform(object_id)
          puts object_id
        end
      end
    end

    after(:all) do
      Ddr::Jobs.send(:remove_const, :TestJob)
    end

    let(:queued) do
      [{"class"=>"Ddr::Jobs::TestJob", "args"=>["test-1"]},
       {"class"=>"Ddr::Jobs::OtherJob", "args"=>["test-2"]},
       {"class"=>"Ddr::Jobs::TestJob", "args"=>["test-3"]},
      ]
    end

    before(:each) do
      allow(Resque).to receive(:size).with(:test) { 3 }
      allow(Resque).to receive(:peek).with(:test, 0, 3) { queued }
    end

    describe ".queued_object_ids" do
      it "returns the list of object_ids for queued jobs of this type" do
        expect(TestJob.queued_object_ids)
          .to contain_exactly("test-1", "test-3")
      end
    end

  end
end

Version data entries

67 entries across 67 versions & 1 rubygems

Version Path
ddr-models-2.4.0 spec/jobs/job_spec.rb
ddr-models-2.4.0.rc6 spec/jobs/job_spec.rb
ddr-models-2.4.0.rc5 spec/jobs/job_spec.rb
ddr-models-2.4.0.rc4 spec/jobs/job_spec.rb
ddr-models-2.4.0.rc3 spec/jobs/job_spec.rb
ddr-models-2.4.0.rc2 spec/jobs/job_spec.rb
ddr-models-2.4.0.rc1 spec/jobs/job_spec.rb