-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathRakefile
57 lines (48 loc) · 1.34 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
56
57
require 'bundler'
Bundler::GemHelper.install_tasks name: 'arel_extensions'
require 'rake/testtask'
desc 'Default Task'
task default: [:test]
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/test_*.rb'
t.warning = true
t.verbose = true
end
namespace :test do
Rake::TestTask.new('to_sql' => []) { |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/visitors/test_to_sql.rb'
t.warning = true
t.verbose = true
t.ruby_opts = ['--dev'] if defined?(JRUBY_VERSION)
}
end
%w[mysql postgresql sqlite ibm_db oracle mssql].each do |adapter|
namespace :test do
Rake::TestTask.new(adapter => "#{adapter}:env") { |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/with_ar/*_agnostic_test.rb'
t.warning = false
t.verbose = true
t.ruby_opts = ['--dev'] if defined?(JRUBY_VERSION)
}
end
namespace adapter do
task test: "test_#{adapter}"
task isolated_test: "isolated_test_#{adapter}"
# Set the connection environment for the adapter
task(:env) { ENV['DB'] = adapter }
end
# Make sure the adapter test evaluates the env setting task
task "test_#{adapter}" => ["#{adapter}:env", "test:#{adapter}"]
end
# Useful shorthands.
namespace :test do
task :sql => :to_sql
task :pg => :postgresql
task :postgres => :postgresql
end