2009-08-06 18:22:10 -04:00
|
|
|
require "rubygems"
|
2007-12-30 14:35:44 -05:00
|
|
|
|
2009-09-20 12:12:55 -04:00
|
|
|
begin
|
|
|
|
require "spec/rake/spectask"
|
|
|
|
rescue LoadError
|
|
|
|
desc "Run specs"
|
|
|
|
task(:spec) { $stderr.puts '`gem install rspec` to run specs' }
|
|
|
|
else
|
|
|
|
namespace :spec do
|
2010-03-23 15:05:35 -04:00
|
|
|
%w[mysql sqlite3 postgresql oracle].each do |adapter|
|
|
|
|
task "set_env_for_#{adapter}" do
|
|
|
|
ENV['ADAPTER'] = adapter
|
|
|
|
end
|
|
|
|
|
2009-09-20 12:12:55 -04:00
|
|
|
Spec::Rake::SpecTask.new(adapter) do |t|
|
2009-10-01 00:13:56 -04:00
|
|
|
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
2009-09-20 12:12:55 -04:00
|
|
|
t.libs << "#{File.dirname(__FILE__)}/spec"
|
2010-09-24 18:23:52 -04:00
|
|
|
t.warning = true
|
2010-03-23 15:05:35 -04:00
|
|
|
t.spec_files = FileList['spec/**/*_spec.rb']
|
2009-09-20 12:12:55 -04:00
|
|
|
end
|
2010-03-23 15:05:35 -04:00
|
|
|
|
|
|
|
desc "Run specs with the #{adapter} database adapter"
|
|
|
|
task adapter => "set_env_for_#{adapter}"
|
2009-05-16 21:13:32 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-09-20 12:12:55 -04:00
|
|
|
desc "Run specs with mysql and sqlite3 database adapters (default)"
|
2009-11-09 19:38:44 -05:00
|
|
|
task :spec => ["spec:sqlite3", "spec:mysql", "spec:postgresql"]
|
2009-05-16 21:13:32 -04:00
|
|
|
|
2009-09-20 12:12:55 -04:00
|
|
|
desc "Default task is to run specs"
|
|
|
|
task :default => :spec
|
|
|
|
end
|