forked from mcls/native_enum
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
52 lines (46 loc) · 1.3 KB
/
Copy pathRakefile
File metadata and controls
52 lines (46 loc) · 1.3 KB
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
require 'bundler'
require 'yaml'
Bundler::GemHelper.install_tasks
DB_CONFIG = "spec/database.yml"
GEMFILES = "spec/Gemfile.rails_[0-9]_[0-9]"
require 'rake'
desc 'Default: run all unit tests.'
task :default => :"spec:all"
namespace :db do
desc 'Prepare the databases.'
task :prepare do
unless File.exist? DB_CONFIG
cp "#{config_file}.tmpl", DB_CONFIG
end
#TODO would be nice to create the DBs here
end
end
require "rspec/core/rake_task"
desc 'Run the test suite.'
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = 'spec/*_spec.rb'
t.exclude_pattern = 'spec/**/vendor/*'
end
desc 'Run the test suite for all DBs.'
namespace :spec do
task :all do
db_config = YAML::load(IO.read(DB_CONFIG))
db_config.each do |db,config|
ENV["DB"] = db
Rake::Task["spec"].reenable
Rake::Task["spec"].invoke
end
end
desc 'Run the test suite for all supported versions of rails and all DBs'
task :rails_all do
STDOUT.sync = true
versions = Dir.glob(GEMFILES)
versions.each do |gemfile|
puts "Running specs for Gemfile: #{gemfile}"
Bundler.with_clean_env do
sh "bundle install --gemfile '#{gemfile}' --path 'vendor/#{File.extname(gemfile).slice(1..-1)}'"
sh "BUNDLE_GEMFILE='#{gemfile}' bundle exec rake spec:all"
end
end
end
end