Updated how tests are run so Rake is not invoked twice.

* removing support for Oracle in the rakefile as it is no currently supported
This commit is contained in:
Zach Dennis 2010-08-10 20:47:55 -04:00
parent fc7f179a34
commit 24feb801f5
5 changed files with 8 additions and 12 deletions

View file

@ -2,7 +2,7 @@ require 'rake/testtask'
task :default => ["display:notice"] task :default => ["display:notice"]
ADAPTERS = %w(mysql postgresql sqlite3 oracle) ADAPTERS = %w(mysql postgresql sqlite3)
namespace :display do namespace :display do
task :notice do task :notice do
@ -12,18 +12,11 @@ namespace :display do
end end
end end
desc "Runs generic database tests."
Rake::TestTask.new("test") { |t|
t.test_files = FileList["test/*_test.rb", "test/#{ENV['ARE_DB']}/**/*_test.rb"]
}
ADAPTERS.each do |adapter| ADAPTERS.each do |adapter|
namespace :test do namespace :test do
desc "Runs unit tests for #{adapter} specific functionality" desc "Runs #{adapter} database tests."
task adapter do Rake::TestTask.new(adapter) do |t|
ENV["ARE_DB"] = adapter t.test_files = FileList["test/adapters/#{adapter}.rb", "test/*_test.rb", "test/#{adapter}/**/*_test.rb"]
exec "rake test"
# exec replaces the current process, never gets here
end end
end end
end end

1
test/adapters/mysql.rb Normal file
View file

@ -0,0 +1 @@
ENV["ARE_DB"] = "mysql"

View file

@ -0,0 +1 @@
ENV["ARE_DB"] = "postgresql"

1
test/adapters/sqlite3.rb Normal file
View file

@ -0,0 +1 @@
ENV["ARE_DB"] = "sqlite3"

View file

@ -3,7 +3,7 @@ common: &common
password: password:
encoding: utf8 encoding: utf8
host: localhost host: localhost
database: aroptests database: activerecord_import_test
mysql: mysql:
<<: *common <<: *common