Sha256: 9c292366f7d8df3747451ba6ff7b5424d5849d6407af4cea10d431c4e05385fc

Contents?: true

Size: 690 Bytes

Versions: 1

Compression:

Stored size: 690 Bytes

Contents

require 'resque_spec'

module ResqueSpec
  module SchedulerExt
    def enqueue_at(time, klass, *args)
      ResqueSpec.enqueue_at(time, klass, *args)
    end

    def enqueue_in(time, klass, *args)
      ResqueSpec.enqueue_in(time, klass, *args)
    end
  end

  def enqueue_at(time, klass, *args)
    store(schedule_queue_name(klass), :class => klass.to_s, :time  => time, :args => args)
  end

  def enqueue_in(time, klass, *args)
    enqueue_at(Time.now + time, klass, *args)
  end

  def schedule_for(klass)
    queues[schedule_queue_name(klass)]
  end

  private

  def schedule_queue_name(klass)
    "#{queue_name(klass)}_scheduled"
  end
end

Resque.extend(ResqueSpec::SchedulerExt)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
resque_spec-0.6.7 lib/resque_spec/scheduler.rb