lib/resque_spec/scheduler.rb in resque_spec-0.12.6 vs lib/resque_spec/scheduler.rb in resque_spec-0.12.7

- old
+ new

@@ -19,29 +19,49 @@ return enqueue_at_without_resque_spec(time, klass, *args) if ResqueSpec.disable_ext && respond_to?(:enqueue_at_without_resque_spec) ResqueSpec.enqueue_at(time, klass, *args) end + def enqueue_at_with_queue(queue, time, klass, *args) + return enqueue_at_with_queue_without_resque_spec(time, klass, *args) if ResqueSpec.disable_ext && respond_to?(:enqueue_at_with_queue_without_resque_spec) + + ResqueSpec.enqueue_at_with_queue(queue, time, klass, *args) + end + def enqueue_in(time, klass, *args) return enqueue_in_without_resque_spec(time, klass, *args) if ResqueSpec.disable_ext && respond_to?(:enqueue_in_without_resque_spec) ResqueSpec.enqueue_in(time, klass, *args) end + def enqueue_in_with_queue(queue, time, klass, *args) + return enqueue_in_with_queue_without_resque_spec(time, klass, *args) if ResqueSpec.disable_ext && respond_to?(:enqueue_in_with_queue_without_resque_spec) + + ResqueSpec.enqueue_in_with_queue(queue, time, klass, *args) + end + def remove_delayed(klass, *args) return remove_delayed_without_resque_spec(klass, *args) if ResqueSpec.disable_ext && respond_to?(:remove_delayed_without_resque_spec) ResqueSpec.remove_delayed(klass, *args) end end def enqueue_at(time, klass, *args) + enqueue_at_with_queue(schedule_queue_name(klass), time, klass, *args) + end + + def enqueue_at_with_queue(queue, time, klass, *args) is_time?(time) - perform_or_store(schedule_queue_name(klass), :class => klass.to_s, :time => time, :stored_at => Time.now, :args => args) + perform_or_store(queue, :class => klass.to_s, :time => time, :stored_at => Time.now, :args => args) end def enqueue_in(time, klass, *args) enqueue_at(Time.now + time, klass, *args) + end + + def enqueue_in_with_queue(queue, time, klass, *args) + enqueue_at_with_queue(queue, Time.now + time, klass, *args) end def remove_delayed(klass, *args) sched_queue = queue_by_name(schedule_queue_name(klass)) count_before_remove = sched_queue.length