aboutsummaryrefslogblamecommitdiffstats
path: root/activejob/test/support/integration/adapters/sneakers.rb
blob: 5dcab6851582806f1e720e9c6541d02640bb3580 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                                                                                                                                                             
require 'sneakers/runner'

module SneakersJobsManager
  def clear_jobs
  end

  def start_workers
    cmd = %{cd #{Rails.root.to_s} && (RAILS_ENV=test AJADAPTER=sneakers WORKERS=ActiveJob::QueueAdapters::SneakersAdapter::JobWrapper bundle exec rake --trace sneakers:run)}
    `#{cmd}`
    while !Rails.root.join("tmp/sneakers.pid").exist? do
      sleep 0.5
    end
  end

  def stop_workers
    Process.kill 'TERM', File.open(Rails.root.join("tmp/sneakers.pid").to_s).read.to_i
  end
end