Module: Delayed::Testing

Defined in:
lib/delayed/testing.rb

Class Method Summary collapse

Class Method Details

.clear_all!Object



25
26
27
28
29
30
31
# File 'lib/delayed/testing.rb', line 25

def self.clear_all!
  case Delayed::Job.name
  when /ActiveRecord/
    Delayed::Job.delete_all
    Delayed::Job::Failed.delete_all
  end
end

.drainObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/delayed/testing.rb', line 9

def self.drain
  while (job = Delayed::Job.get_and_lock_next_available(
    "spec run_jobs",
    Delayed::Settings.queue,
    0,
    Delayed::MAX_PRIORITY
  ))
    run_job(job)
  end
end

.run_job(job) ⇒ Object



5
6
7
# File 'lib/delayed/testing.rb', line 5

def self.run_job(job)
  Delayed::Worker.new.perform(job)
end

.track_created(&block) ⇒ Object



20
21
22
23
# File 'lib/delayed/testing.rb', line 20

def self.track_created(&block)
  job_tracking = JobTracking.track(&block)
  job_tracking.created
end