aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/Rakefile
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-06-04 23:19:17 +0100
committerJon Leighton <j@jonathanleighton.com>2011-06-04 23:47:03 +0100
commit253bb6b9260938ed673e2c0059d729cffff4a523 (patch)
treecf8aa429645a0c73d32e8fe0eecf62a536488bdd /activerecord/Rakefile
parentcdce7ff191313bd99a31d26ddca5a5c8be766695 (diff)
downloadrails-253bb6b9260938ed673e2c0059d729cffff4a523.tar.gz
rails-253bb6b9260938ed673e2c0059d729cffff4a523.tar.bz2
rails-253bb6b9260938ed673e2c0059d729cffff4a523.zip
Refactor Active Record test connection setup. Please see the RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
Diffstat (limited to 'activerecord/Rakefile')
-rwxr-xr-xactiverecord/Rakefile8
1 files changed, 3 insertions, 5 deletions
diff --git a/activerecord/Rakefile b/activerecord/Rakefile
index 346c7e8142..d5863ab14d 100755
--- a/activerecord/Rakefile
+++ b/activerecord/Rakefile
@@ -43,26 +43,24 @@ end
%w( mysql mysql2 postgresql sqlite3 sqlite3_mem firebird db2 oracle sybase openbase frontbase jdbcmysql jdbcpostgresql jdbcsqlite3 jdbcderby jdbch2 jdbchsqldb ).each do |adapter|
Rake::TestTask.new("test_#{adapter}") { |t|
- connection_path = "test/connections/#{adapter =~ /jdbc/ ? 'jdbc' : 'native'}_#{adapter}"
adapter_short = adapter == 'db2' ? adapter : adapter[/^[a-z0-9]+/]
- t.libs << "test" << connection_path
t.test_files = (Dir.glob( "test/cases/**/*_test.rb" ).reject {
|x| x =~ /\/adapters\//
} + Dir.glob("test/cases/adapters/#{adapter_short}/**/*_test.rb")).sort
t.verbose = true
t.warning = true
+ t.ruby_opts = ["-r#{File.expand_path('../', __FILE__)}/test/connections/#{adapter}"]
}
task "isolated_test_#{adapter}" do
- connection_path = "test/connections/#{adapter =~ /jdbc/ ? 'jdbc' : 'native'}_#{adapter}"
adapter_short = adapter == 'db2' ? adapter : adapter[/^[a-z0-9]+/]
- puts [adapter, adapter_short, connection_path].inspect
+ puts [adapter, adapter_short].inspect
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
(Dir["test/cases/**/*_test.rb"].reject {
|x| x =~ /\/adapters\//
} + Dir["test/cases/adapters/#{adapter_short}/**/*_test.rb"]).all? do |file|
- sh(ruby, "-Ilib:test:#{connection_path}", file)
+ sh(ruby, "-Itest", "-r#{File.expand_path('../', __FILE__)}/test/connections/#{adapter}", file)
end or raise "Failures"
end