Skip to content

Commit

Permalink
Skip `MultipleFailureTest#test_failure_is_passed_on_when_job_class_no…
Browse files Browse the repository at this point in the history
…t_found` test as its no longer possible with resque v1.20.0
  • Loading branch information
lantins committed Mar 11, 2012
1 parent 03dcc68 commit d6c7529
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/multiple_failure_test.rb
@@ -1,6 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/test_helper')

class MultipleFailureTest < MiniTest::Unit::TestCase

def setup
Resque.redis.flushall
@worker = Resque::Worker.new(:testing)
Expand All @@ -14,19 +15,20 @@ def setup

def failure_key_for(klass)
args = []
key = "failure-" + klass.redis_retry_key(args)
key = 'failure-' + klass.redis_retry_key(args)
end

def test_failure_is_passed_on_when_job_class_not_found
skip 'commit 7113b0df to `resque` gem means the failure backend is never called'
new_job_class = Class.new(LimitThreeJob).tap { |klass| klass.send(:instance_variable_set, :@queue, LimitThreeJob.instance_variable_get(:@queue)) }
Object.send(:const_set, 'LimitThreeJobTemp', new_job_class)
Resque.enqueue(LimitThreeJobTemp)

Object.send(:remove_const, 'LimitThreeJobTemp')
perform_next_job(@worker)

assert_equal MockFailureBackend.errors.count, 1
assert MockFailureBackend.errors.first =~ /uninitialized constant LimitThreeJobTemp/
assert_equal 1, MockFailureBackend.errors.count, 'should have one error'
assert_match /uninitialized constant LimitThreeJobTemp/, MockFailureBackend.errors.first
end

def test_last_failure_is_saved_in_redis_if_delay
Expand All @@ -42,9 +44,9 @@ def test_retry_key_splatting_args
# were expecting this to be called twice:
# - once before the job is executed.
# - once by the failure backend.
RetryDefaultsJob.expects(:redis_retry_key).with({"a" => 1, "b" => 2}).times(2)
RetryDefaultsJob.expects(:redis_retry_key).with({'a' => 1, 'b' => 2}).times(2)

Resque.enqueue(RetryDefaultsJob, {"a" => 1, "b" => 2})
Resque.enqueue(RetryDefaultsJob, {'a' => 1, 'b' => 2})
perform_next_job(@worker)
end

Expand Down

0 comments on commit d6c7529

Please sign in to comment.