|
1 | 1 | desc "Run the full suite using parallel_tests to run on multiple cores"
|
2 | 2 | task test: [:setup, :spec, :cucumber]
|
3 | 3 |
|
4 |
| -desc "Create a test rails app for the parallel specs to run against" |
5 |
| -task :setup, [:rails_env, :template] do |_t, opts| |
6 |
| - if ENV["COVERAGE"] == "true" |
7 |
| - require "simplecov" |
| 4 | +desc "Create a test rails app for the parallel specs to run against if it doesn't exist already" |
| 5 | +task setup: :"setup:create" |
8 | 6 |
|
9 |
| - SimpleCov.command_name "test app creation" |
| 7 | +namespace :setup do |
| 8 | + desc "Forcefully create a test rails app for the parallel specs to run against" |
| 9 | + task :force, [:rails_env, :template] => [:require, :rm, :run] |
| 10 | + |
| 11 | + desc "Create a test rails app for the parallel specs to run against if it doesn't exist already" |
| 12 | + task :create, [:rails_env, :template] => [:require, :guard, :run] |
| 13 | + |
| 14 | + desc "Makes test app creation code available" |
| 15 | + task :require do |
| 16 | + if ENV["COVERAGE"] == "true" |
| 17 | + require "simplecov" |
| 18 | + |
| 19 | + SimpleCov.command_name "test app creation" |
| 20 | + end |
| 21 | + |
| 22 | + require_relative "test_application" |
| 23 | + end |
| 24 | + |
| 25 | + desc "Create a test rails app for the parallel specs to run against" |
| 26 | + task :run, [:rails_env, :template] do |_t, opts| |
| 27 | + ActiveAdmin::TestApplication.new(opts).generate |
10 | 28 | end
|
11 | 29 |
|
12 |
| - require_relative "test_application" |
| 30 | + desc "Aborts if the test app already exists" |
| 31 | + task :guard, [:rails_env, :template] do |_t, opts| |
| 32 | + test_app = ActiveAdmin::TestApplication.new(opts) |
13 | 33 |
|
14 |
| - ActiveAdmin::TestApplication.new(opts).generate |
| 34 | + app_dir = test_app.app_dir |
| 35 | + |
| 36 | + if File.exist? app_dir |
| 37 | + abort "test app #{app_dir} already exists; skipping test app generation" |
| 38 | + end |
| 39 | + end |
| 40 | + |
| 41 |
10000
+ task :rm, [:rails_env, :template] do |_t, opts| |
| 42 | + test_app = ActiveAdmin::TestApplication.new(opts) |
| 43 | + |
| 44 | + FileUtils.rm_rf test_app.app_dir |
| 45 | + end |
15 | 46 | end
|
16 | 47 |
|
17 | 48 | task spec: :"spec:all"
|
|
0 commit comments