lib/resque_spec/scheduler.rb in resque_spec-0.11.0 vs lib/resque_spec/scheduler.rb in resque_spec-0.12.0
- old
+ new
@@ -41,12 +41,16 @@
def enqueue_in(time, klass, *args)
enqueue_at(Time.now + time, klass, *args)
end
def remove_delayed(klass, *args)
- queue_by_name(schedule_queue_name(klass)).delete_if do |job|
+ sched_queue = queue_by_name(schedule_queue_name(klass))
+ count_before_remove = sched_queue.length
+ sched_queue.delete_if do |job|
job[:class] == klass.to_s && job[:args] == args
end
+ # Return number of removed items to match Resque Scheduler behaviour
+ count_before_remove - sched_queue.length
end
def schedule_for(klass)
queue_by_name(schedule_queue_name(klass))
end