aboutsummaryrefslogblamecommitdiffstats
path: root/activejob/test/support/integration/adapters/delayed_job.rb
blob: 0b591964bc5e2202197cfc60cb89773d30650671 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                                
                                                                                               






                                          
require 'delayed_job'
require 'delayed_job_active_record'

module DelayedJobJobsManager
  def setup
    ActiveJob::Base.queue_adapter = :delayed_job
  end
  def clear_jobs
    Delayed::Job.delete_all
  end

  def start_workers
    @worker = Delayed::Worker.new(quiet: true, sleep_delay: 0.5, queues: %w(integration_tests))
    @thread = Thread.new { @worker.start }
  end

  def stop_workers
    @worker.stop
  end
end