Sha256: fb36730f4e7e298e2e795c37abd2ad1185c72d6523eec47409002fce43b2acbc

Contents?: true

Size: 729 Bytes

Versions: 2

Compression:

Stored size: 729 Bytes

Contents

require File.expand_path('../../spec_helper.rb', __FILE__)

module SimpleWorker
  describe RetryListener do
    let(:redis)     { double(Redis) }
    let(:namespace) { 'my_namespace' }
    let(:jobid)     { 'my_jobid' }
    let(:hostname)  { 'my_hostname' }
    let(:jobid)     { 'my_jobid' }

    it 'does not retry if max retries is 0' do
      listener = RetryListener.new(redis, 0, namespace, jobid)
      redis.should_not_receive(:rpush)

      listener.on_task_expire(hostname, jobid)
    end

    it 'does retry once if max retries is 1' do
      listener = RetryListener.new(redis, 1, namespace, jobid)
      redis.should_receive(:rpush).once

      2.times { listener.on_task_expire(hostname, jobid) }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simpleworker-0.1.1 spec/simpleworker/retry_listener_spec.rb
simpleworker-0.1.0 spec/simpleworker/retry_listener_spec.rb