test/test_helper.rb in resque-retry-0.0.6 vs test/test_helper.rb in resque-retry-0.1.0
- old
+ new
@@ -3,11 +3,16 @@
$TESTING = true
require 'test/unit'
require 'rubygems'
require 'turn'
+require 'simplecov-html'
+SimpleCov.start do
+ add_filter "/test/"
+end
+
require 'resque-retry'
require dir + '/test_jobs'
# make sure we can run redis
@@ -38,10 +43,23 @@
puts "Starting redis for testing at localhost:9736..."
`redis-server #{dir}/redis-test.conf`
Resque.redis = '127.0.0.1:9736'
+# Mock failure backend for testing MultipleWithRetrySuppression
+class MockFailureBackend < Resque::Failure::Base
+ class << self
+ attr_accessor :errors
+ end
+
+ def save
+ self.class.errors << exception.to_s
+ end
+
+ self.errors = []
+end
+
# Test helpers
class Test::Unit::TestCase
def perform_next_job(worker, &block)
return unless job = @worker.reserve
@worker.perform(job, &block)
@@ -55,6 +73,6 @@
worker = Resque::Worker.new(:testing)
return false unless job = worker.reserve
worker.perform(job)
worker.done_working
end
-end
\ No newline at end of file
+end