aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/Rakefile
blob: b2910de81dbdde08db0c79804f49197cffd221cb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
require 'bundler/gem_tasks'

require 'rake/testtask'

def run_without_aborting(*tasks)
  errors = []

  tasks.each do |task|
    begin
      Rake::Task[task].invoke
    rescue Exception
      errors << task
    end
  end

  abort "Errors running #{errors.join(', ')}" if errors.any?
end

task default: :test

ADAPTERS = %w(inline delayed_job qu que queue_classic resque sidekiq sneakers sucker_punch backburner)

desc 'Run all adapter tests'
task :test do
  tasks = ADAPTERS.map{|a| "test_#{a}" }+["integration_test"]
  run_without_aborting(*tasks)
end

ADAPTERS.each do |adapter|
  Rake::TestTask.new("test_#{adapter}") do |t|
    t.libs << 'test'
    t.test_files = FileList['test/cases/**/*_test.rb']
    t.verbose = true
  end

  namespace adapter do
    task test: "test_#{adapter}"
    task(:env) { ENV['AJADAPTER'] = adapter }
  end

  task "test_#{adapter}" => "#{adapter}:env"
end



desc 'Run all adapter integration tests'
task :integration_test do
  tasks = (ADAPTERS-['inline']).map{|a| "integration_test_#{a}" }
  run_without_aborting(*tasks)
end

(ADAPTERS-['inline']).each do |adapter|
  Rake::TestTask.new("integration_test_#{adapter}") do |t|
    t.libs << 'test'
    t.test_files = FileList['test/integration/**/*_test.rb']
    t.verbose = true
  end

  namespace "integration_#{adapter}" do
    task test: "integration_test_#{adapter}"
    task(:env) do
      ENV['AJADAPTER'] = adapter
      ENV['AJ_INTEGRATION_TESTS'] = "1"
    end
  end

  task "integration_test_#{adapter}" => "integration_#{adapter}:env"
end