Sha256: 36862a9fa5a59a55f62d3a53e22fc1c155510ce27e28ab94c1cfbd533df79ad5

Contents?: true

Size: 956 Bytes

Versions: 9

Compression:

Stored size: 956 Bytes

Contents

require 'spec_helper'
require 'support/worker_helper'

describe Resqutils::StaleWorkersKiller do
  include WorkerHelper
  let(:stale_workers) {
    [
      worker,
      worker,
      worker,
    ]
  }
  before do
    allow(Resque).to receive(:enqueue)
  end
  describe "kill_stale_workers" do
    before do

      described_class.new(stale_workers: stale_workers).kill_stale_workers
    end
    it "queues a job for all stale workers" do
      stale_workers.each do |worker|
        expect(Resque).to have_received(:enqueue).with(Resqutils::WorkerKillerJob,worker.id)
      end
    end
  end
  describe "::perform" do
    before do
      allow(Resqutils::StaleWorkers).to receive(:new).and_return(stale_workers)
      described_class.perform
    end
    it "queues a job for all stale workers" do
      stale_workers.each do |worker|
        expect(Resque).to have_received(:enqueue).with(Resqutils::WorkerKillerJob,worker.id)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
resqutils-1.3.4 spec/stale_workers_killer_spec.rb
resqutils-1.3.3 spec/stale_workers_killer_spec.rb
resqutils-1.3.2 spec/stale_workers_killer_spec.rb
resqutils-1.3.1 spec/stale_workers_killer_spec.rb
resqutils-1.3.0 spec/stale_workers_killer_spec.rb
resqutils-1.2.1 spec/stale_workers_killer_spec.rb
resqutils-1.2.0 spec/stale_workers_killer_spec.rb
resqutils-1.1.1 spec/stale_workers_killer_spec.rb
resqutils-1.1.0 spec/stale_workers_killer_spec.rb