-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
51 lines (39 loc) · 1.04 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
# frozen_string_literal: true
require "bundler/gem_tasks"
require "rake/testtask"
def run_without_aborting(*tasks)
errors = []
tasks.each do |task|
Rake::Task[task].invoke
rescue StandardError => e
puts task
puts e
errors << task
end
abort "Errors running #{errors.join(", ")}" if errors.any?
end
%w[mysql2 sqlite3 postgresql].each do |adapter|
namespace :test do
Rake::TestTask.new(adapter => "#{adapter}:env") do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/test_*.rb"]
end
end
namespace adapter do
desc "Adapter Tests"
task test: adapter
# Set the connection environment for the adapter
desc "Env for adapter tests"
task(:env) { ENV["TEST_ADAPTER"] = adapter }
end
task "test_#{adapter}" => ["#{adapter}:env", "test:#{adapter}"]
end
desc "Default Tests"
task :test do
tasks = %w[test_mysql2 test_sqlite3 test_postgresql]
run_without_aborting(*tasks)
end
require "rubocop/rake_task"
RuboCop::RakeTask.new
task default: %i[test rubocop]