lib/sidekiq/testing.rb in sidekiq-5.1.3 vs lib/sidekiq/testing.rb in sidekiq-5.2.0
- old
+ new
@@ -70,13 +70,11 @@
# Default to fake testing to keep old behavior
Sidekiq::Testing.fake!
class EmptyQueueError < RuntimeError; end
- class Client
- alias_method :raw_push_real, :raw_push
-
+ module TestingClient
def raw_push(payloads)
if Sidekiq::Testing.fake?
payloads.each do |job|
job = Sidekiq.load_json(Sidekiq.dump_json(job))
job.merge!('enqueued_at' => Time.now.to_f) unless job['at']
@@ -90,13 +88,15 @@
job_hash = Sidekiq.load_json(Sidekiq.dump_json(job))
klass.process_job(job_hash)
end
true
else
- raw_push_real(payloads)
+ super
end
end
end
+
+ Sidekiq::Client.prepend TestingClient
module Queues
##
# The Queues class is only for testing the fake queue implementation.
# There are 2 data structures involved in tandem. This is due to the