-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRakefile
55 lines (40 loc) · 1.47 KB
/
Rakefile
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
# frozen_string_literal: true
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require_relative "config/application"
Rails.application.load_tasks
return if Rails.env.production?
desc "Cleanup temporary spec files"
task :clean do
[:census_connector, :crowdfundings, :gravity_forms, :votings].each do |component|
rm_rf "decidim-module-#{component}/spec/decidim_dummy_app"
end
end
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
desc "Runs all tests in the main application"
task :spec do
system!("SIMPLECOV=true bundle exec rspec")
end
namespace :spec do
[:census_connector, :crowdfundings, :gravity_forms, :votings].each do |component|
desc "Run #{component} specs"
task component do
folder = "decidim-module-#{component}"
Dir.chdir(folder) do
Bundler.with_original_env do
system("bundle check") || system!("bundle install")
system!("bundle exec rake test_app") unless Dir.exist?("spec/decidim_dummy_app")
system!("SIMPLECOV=true bundle exec rspec")
end
end
end
end
task components: [:census_connector, :crowdfundings, :gravity_forms, :votings]
end
desc "Runs all specs, using existing test apps"
task all_specs: [:spec, :"spec:components"]
desc "Runs all specs, fully resetting all test apps"
task full_specs: [:clean, :all_specs]
task default: :all_specs