aboutsummaryrefslogblamecommitdiffstats
path: root/activejob/test/support/integration/adapters/delayed_job.rb
blob: 2adbbcd88fb28d8f475df1960fed8202c3b96e51 (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