lib/sidekiq/testing.rb in sidekiq-3.2.5 vs lib/sidekiq/testing.rb in sidekiq-3.2.6
- old
+ new
@@ -151,20 +151,24 @@
# Drain and run all jobs for this worker
def drain
while job = jobs.shift do
worker = new
worker.jid = job['jid']
- worker.perform(*job['args'])
+ execute_job(worker, job['args'])
end
end
# Pop out a single job and perform it
def perform_one
raise(EmptyQueueError, "perform_one called with empty job queue") if jobs.empty?
job = jobs.shift
worker = new
worker.jid = job['jid']
- worker.perform(*job['args'])
+ execute_job(worker, job['args'])
+ end
+
+ def execute_job(worker, args)
+ worker.perform(*args)
end
end
class << self
def jobs # :nodoc: