Skip to content

Commit

Permalink
Whoops, missed the testing rake file
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksieger committed Sep 30, 2009
1 parent e61eaf3 commit 8f11231
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions rakelib/test.rake
@@ -0,0 +1,71 @@
require File.dirname(__FILE__) + '/../test/helper'
if defined?(JRUBY_VERSION)
databases = [:test_mysql, :test_jdbc, :test_derby, :test_hsqldb, :test_h2, :test_sqlite3]
if find_executable?("psql") && `psql -c '\\l'` && $?.exitstatus == 0
databases << :test_postgres
end
task :test => databases
else
task :test => [:test_mysql]
end

FileList['drivers/*'].each do |d|
next unless File.directory?(d)
driver = File.basename(d)
Rake::TestTask.new("test_#{driver}") do |t|
files = FileList["test/#{driver}*test.rb"]
if driver == "derby"
files << 'test/activerecord/connection_adapters/type_conversion_test.rb'
end
t.test_files = files
t.libs = []
if defined?(JRUBY_VERSION)
t.ruby_opts << "-rjdbc/#{driver}"
t.libs << "lib" << "#{d}/lib"
t.libs.push *FileList["adapters/#{driver}*/lib"]
end
t.libs << "test"
t.verbose = true
end
end

Rake::TestTask.new(:test_jdbc) do |t|
t.test_files = FileList['test/generic_jdbc_connection_test.rb', 'test/jndi_callbacks_test.rb']
t.libs << 'test' << 'drivers/mysql/lib'
end

Rake::TestTask.new(:test_jndi) do |t|
t.test_files = FileList['test/jndi_test.rb']
t.libs << 'test' << 'drivers/derby/lib'
end

task :test_postgresql => [:test_postgres]
task :test_pgsql => [:test_postgres]

# Ensure driver for these DBs is on your classpath
%w(oracle db2 cachedb mssql informix).each do |d|
Rake::TestTask.new("test_#{d}") do |t|
t.test_files = FileList["test/#{d}_simple_test.rb"]
t.libs = []
t.libs << 'lib' if defined?(JRUBY_VERSION)
t.libs << 'test'
end
end

# Tests for JDBC adapters that don't require a database.
Rake::TestTask.new(:test_jdbc_adapters) do | t |
t.test_files = FileList[ 'test/jdbc_adapter/jdbc_sybase_test.rb' ]
t.libs << 'test'
end

# Ensure that the jTDS driver is in your classpath before launching rake
Rake::TestTask.new(:test_sybase_jtds) do |t|
t.test_files = FileList['test/sybase_jtds_simple_test.rb']
t.libs << 'test'
end

# Ensure that the jConnect driver is in your classpath before launching rake
Rake::TestTask.new(:test_sybase_jconnect) do |t|
t.test_files = FileList['test/sybase_jconnect_simple_test.rb']
t.libs << 'test'
end

0 comments on commit 8f11231

Please sign in to comment.