Sha256: a0d43503fbf0721d22ede9469cce81bb3ac4ee681026efd8161334c0ef2a1ee6

Contents?: true

Size: 435 Bytes

Versions: 1

Compression:

Stored size: 435 Bytes

Contents

require 'resque_spec'

module ResqueSpec
  def schedule_for(klass)
    name = "#{queue_name(klass)}_scheduled"
    queues[name]
  end

  module SchedulerExt
    def enqueue_at(time, klass, *args)
      if ResqueSpec.inline
        klass.send(:perform, *args)
      else
        ResqueSpec.schedule_for(klass) << {:klass => klass.to_s, :time  => time, :args => args}
      end
    end
  end
end

Resque.extend(ResqueSpec::SchedulerExt)

Version data entries

1 entries across 1 versions & 1 rubygems

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