Sha256: 31b7f53d3355b192de282b387e4d352c950e9ffdf19b9c68e77f7f9f437159ee

Contents?: true

Size: 814 Bytes

Versions: 11

Compression:

Stored size: 814 Bytes

Contents

require 'test_helper'

class IgnoreExceptionsTest < Minitest::Test
  def setup
    Resque.redis.flushall
    @worker = Resque::Worker.new(:testing)
    @worker.register_worker
  end

  def test_ignore_exceptions
    Resque.enqueue(IgnoreExceptionsJob)
    retry_key = IgnoreExceptionsJob.redis_retry_key

    IgnoreExceptionsJob.stubs(:perform).raises(AnotherCustomException)
    perform_next_job(@worker)
    assert_equal '0', Resque.redis.get(retry_key), 'retry counter'

    IgnoreExceptionsJob.stubs(:perform).raises(AnotherCustomException)
    perform_next_job(@worker)
    assert_equal '1', Resque.redis.get(retry_key), 'retry counter'

    IgnoreExceptionsJob.stubs(:perform).raises(CustomException)
    perform_next_job(@worker)
    assert_equal '1', Resque.redis.get(retry_key), 'retry counter'
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
resque-retry-1.8.1 test/ignore_exceptions_test.rb
resque-retry-1.8.0 test/ignore_exceptions_test.rb
resque-retry-1.7.6 test/ignore_exceptions_test.rb
resque-retry-1.7.5 test/ignore_exceptions_test.rb
resque-retry-1.7.4 test/ignore_exceptions_test.rb
resque-retry-1.7.3 test/ignore_exceptions_test.rb
resque-retry-1.7.2 test/ignore_exceptions_test.rb
resque-retry-1.7.1 test/ignore_exceptions_test.rb
resque-retry-1.7.0 test/ignore_exceptions_test.rb
resque-retry-1.6.0 test/ignore_exceptions_test.rb
resque-retry-1.5.3 test/ignore_exceptions_test.rb