2007-12-30 14:35:44 -05:00
|
|
|
require 'rubygems'
|
|
|
|
require 'spec/rake/spectask'
|
|
|
|
|
2009-05-16 21:13:32 -04:00
|
|
|
spec_file_list = FileList['spec/**/*_spec.rb']
|
2007-12-30 14:35:44 -05:00
|
|
|
|
2009-05-16 21:13:32 -04:00
|
|
|
desc "Run specs using RCov (uses mysql database adapter)"
|
2008-01-14 11:09:46 -05:00
|
|
|
Spec::Rake::SpecTask.new(:coverage) do |t|
|
2009-05-16 21:13:32 -04:00
|
|
|
t.spec_files =
|
|
|
|
["spec/connections/mysql_connection.rb"] +
|
|
|
|
spec_file_list
|
2009-05-17 16:20:25 -04:00
|
|
|
|
2008-01-14 11:09:46 -05:00
|
|
|
t.rcov = true
|
2009-05-17 16:20:25 -04:00
|
|
|
t.rcov_opts << '--exclude' << "spec,gems"
|
|
|
|
t.rcov_opts << '--text-summary'
|
|
|
|
t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
|
|
|
|
t.rcov_opts << '--only-uncovered'
|
2008-01-14 11:09:46 -05:00
|
|
|
end
|
|
|
|
|
2009-05-16 21:13:32 -04:00
|
|
|
namespace :spec do
|
|
|
|
for adapter in %w[mysql sqlite3]
|
|
|
|
desc "Run specs with the #{adapter} database adapter"
|
|
|
|
Spec::Rake::SpecTask.new(adapter) do |t|
|
|
|
|
t.spec_files =
|
|
|
|
["spec/connections/#{adapter}_connection.rb"] +
|
|
|
|
["spec/schemas/#{adapter}_schema.rb"] +
|
|
|
|
spec_file_list
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Run specs with mysql and sqlite3 database adapters (default)"
|
|
|
|
task :spec => ["spec:sqlite3", "spec:mysql"]
|
|
|
|
|
2007-12-30 14:35:44 -05:00
|
|
|
desc "Default task is to run specs"
|
2009-05-17 14:59:06 -04:00
|
|
|
task :default => :spec
|
|
|
|
|
|
|
|
desc 'Removes trailing whitespace'
|
|
|
|
task :whitespace do
|
|
|
|
sh %{find . -name '*.rb' -exec sed -i '' 's/ *$//g' {} \\;}
|
|
|
|
end
|