-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
60 lines (50 loc) · 1.74 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
58
59
60
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
require 'rspec/core/rake_task'
require 'fileutils'
# require 'rdoc/task'
namespace :test do
task :prepare_database do
FileUtils.copy 'spec/dummy/config/database.sqlite.yml', 'spec/dummy/config/database.yml'
end
RSpec::Core::RakeTask.new(:unit_specs) do |t|
t.pattern = ['spec/lib/**/*_spec.rb']
end
task :unit => [:prepare_database, :unit_specs]
namespace :integration do
rule '.yml' do |file|
FileUtils.copy ('spec/dummy/config/' + file.name), 'spec/dummy/config/database.yml'
end
task :sqlite => 'database.sqlite.yml' do
RSpec::Core::RakeTask.new(:sqlite_integration) do |t|
t.pattern = 'spec/integration/active_record_integration_spec.rb'
end
Rake::Task['sqlite_integration'].execute
end
task :postgresql => 'database.postgresql.yml' do
RSpec::Core::RakeTask.new(:postgresql_integration) do |t|
t.pattern = 'spec/integration/active_record_integration_spec.rb'
end
Rake::Task['postgresql_integration'].execute
end
task :mysql => 'database.mysql.yml' do
RSpec::Core::RakeTask.new(:mysql_integration) do |t|
t.pattern = 'spec/integration/active_record_integration_spec.rb'
end
Rake::Task['mysql_integration'].execute
end
task :all => [:sqlite, :postgresql, :mysql]
end
end
task :default => ['test:unit', 'test:integration:all']
# RDoc::Task.new(:rdoc) do |rdoc|
# rdoc.rdoc_dir = 'rdoc'
# rdoc.title = 'PolymorphicConstraints'
# rdoc.options << '--line-numbers'
# rdoc.rdoc_files.include('README.rdoc')
# rdoc.rdoc_files.include('lib/**/*.rb')
# end
Bundler::GemHelper.install_tasks