Rakefile in wvanbergen-scoped_search-1.0.0 vs Rakefile in wvanbergen-scoped_search-1.0.1

- old
+ new

@@ -1,25 +1,43 @@ -require 'rubygems' -require 'rake/rdoctask' - Dir['tasks/*.rake'].each { |file| load(file) } -desc 'Default: run unit tests.' task :default => [:test] -############################################## -# Build RDocs -############################################## -desc 'Generate documentation for the acts_as_callback_logger plugin.' -Rake::RDocTask.new do |rdoc| - rdoc.rdoc_dir = 'doc/html' - rdoc.title = 'scoped_search' - rdoc.options << '--line-numbers' << '--inline-source' - rdoc.main = 'README' - rdoc.rdoc_files.include('README', - 'CHANGELOG', - 'LICENSE', - 'TODO', - 'lib/') -end -############################################## +namespace :test do + + desc "Run tests for all configured databases in test/database.yml" + task :all do + + databases = YAML.load(File.read(File.dirname(__FILE__) + '/test/database.yml')) + databases.each do |database, config| + puts "\nRunning testsuite on #{database} database...\n\n" + sh "rake test DATABASE=#{database}" + end + puts "\nFinished testing for all configured databases!" + puts "(Configure databases by adjusting test/database.yml)" + end + + task :single do + database = ENV['DATABASE'] || 'sqlite3' + puts "Running testsuite on #{database} database...\n" + sh "rake test DATABASE=#{database}" + end + + desc "Run tests on SQLite3 database" + task :sqlite3 do + puts "Running testsuite on SQLite3 database...\n" + sh 'rake test DATABASE=sqlite3' + end + desc "Run tests on MySQL database" + task :mysql do + puts "Running testsuite on MySQL database...\n" + sh 'rake test DATABASE=mysql' + end + + desc "Run tests on PostgrSQL database" + task :postgresql do + puts "Running testsuite on PostgreSQL database...\n" + sh 'rake test DATABASE=postgresql' + end + +end \ No newline at end of file