From 253bb6b9260938ed673e2c0059d729cffff4a523 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Sat, 4 Jun 2011 23:19:17 +0100 Subject: 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. --- activerecord/test/connections/db2.rb | 1 + activerecord/test/connections/firebird.rb | 1 + activerecord/test/connections/frontbase.rb | 1 + .../test/connections/jdbc_jdbcderby/connection.rb | 18 ----------- .../test/connections/jdbc_jdbch2/connection.rb | 18 ----------- .../test/connections/jdbc_jdbchsqldb/connection.rb | 18 ----------- .../test/connections/jdbc_jdbcmysql/connection.rb | 26 ---------------- .../connections/jdbc_jdbcpostgresql/connection.rb | 26 ---------------- .../connections/jdbc_jdbcsqlite3/connection.rb | 25 ---------------- activerecord/test/connections/jdbcderby.rb | 1 + activerecord/test/connections/jdbch2.rb | 1 + activerecord/test/connections/jdbchsqldb.rb | 1 + activerecord/test/connections/jdbcmysql.rb | 1 + activerecord/test/connections/jdbcpostgresql.rb | 1 + activerecord/test/connections/jdbcsqlite3.rb | 1 + activerecord/test/connections/mysql.rb | 1 + activerecord/test/connections/mysql2.rb | 1 + .../test/connections/native_db2/connection.rb | 25 ---------------- .../test/connections/native_firebird/connection.rb | 26 ---------------- .../connections/native_frontbase/connection.rb | 27 ----------------- .../test/connections/native_mysql/connection.rb | 25 ---------------- .../test/connections/native_mysql2/connection.rb | 25 ---------------- .../test/connections/native_openbase/connection.rb | 21 ------------- .../test/connections/native_oracle/connection.rb | 35 ---------------------- .../connections/native_postgresql/connection.rb | 21 ------------- .../test/connections/native_sqlite3/connection.rb | 16 ---------- .../connections/native_sqlite3_mem/connection.rb | 19 ------------ .../test/connections/native_sybase/connection.rb | 23 -------------- activerecord/test/connections/openbase.rb | 1 + activerecord/test/connections/oracle.rb | 1 + activerecord/test/connections/postgresql.rb | 1 + activerecord/test/connections/sqlite3.rb | 1 + activerecord/test/connections/sqlite3_mem.rb | 1 + activerecord/test/connections/sybase.rb | 1 + 34 files changed, 17 insertions(+), 394 deletions(-) create mode 100644 activerecord/test/connections/db2.rb create mode 100644 activerecord/test/connections/firebird.rb create mode 100644 activerecord/test/connections/frontbase.rb delete mode 100644 activerecord/test/connections/jdbc_jdbcderby/connection.rb delete mode 100644 activerecord/test/connections/jdbc_jdbch2/connection.rb delete mode 100644 activerecord/test/connections/jdbc_jdbchsqldb/connection.rb delete mode 100644 activerecord/test/connections/jdbc_jdbcmysql/connection.rb delete mode 100644 activerecord/test/connections/jdbc_jdbcpostgresql/connection.rb delete mode 100644 activerecord/test/connections/jdbc_jdbcsqlite3/connection.rb create mode 100644 activerecord/test/connections/jdbcderby.rb create mode 100644 activerecord/test/connections/jdbch2.rb create mode 100644 activerecord/test/connections/jdbchsqldb.rb create mode 100644 activerecord/test/connections/jdbcmysql.rb create mode 100644 activerecord/test/connections/jdbcpostgresql.rb create mode 100644 activerecord/test/connections/jdbcsqlite3.rb create mode 100644 activerecord/test/connections/mysql.rb create mode 100644 activerecord/test/connections/mysql2.rb delete mode 100644 activerecord/test/connections/native_db2/connection.rb delete mode 100644 activerecord/test/connections/native_firebird/connection.rb delete mode 100644 activerecord/test/connections/native_frontbase/connection.rb delete mode 100644 activerecord/test/connections/native_mysql/connection.rb delete mode 100644 activerecord/test/connections/native_mysql2/connection.rb delete mode 100644 activerecord/test/connections/native_openbase/connection.rb delete mode 100644 activerecord/test/connections/native_oracle/connection.rb delete mode 100644 activerecord/test/connections/native_postgresql/connection.rb delete mode 100644 activerecord/test/connections/native_sqlite3/connection.rb delete mode 100644 activerecord/test/connections/native_sqlite3_mem/connection.rb delete mode 100644 activerecord/test/connections/native_sybase/connection.rb create mode 100644 activerecord/test/connections/openbase.rb create mode 100644 activerecord/test/connections/oracle.rb create mode 100644 activerecord/test/connections/postgresql.rb create mode 100644 activerecord/test/connections/sqlite3.rb create mode 100644 activerecord/test/connections/sqlite3_mem.rb create mode 100644 activerecord/test/connections/sybase.rb (limited to 'activerecord/test/connections') diff --git a/activerecord/test/connections/db2.rb b/activerecord/test/connections/db2.rb new file mode 100644 index 0000000000..f43b3fda57 --- /dev/null +++ b/activerecord/test/connections/db2.rb @@ -0,0 +1 @@ +ENV['ARCONN'] = 'db2' diff --git a/activerecord/test/connections/firebird.rb b/activerecord/test/connections/firebird.rb new file mode 100644 index 0000000000..fa874c0bb3 --- /dev/null +++ b/activerecord/test/connections/firebird.rb @@ -0,0 +1 @@ +ENV['ARCONN'] = 'firebird' diff --git a/activerecord/test/connections/frontbase.rb b/activerecord/test/connections/frontbase.rb new file mode 100644 index 0000000000..9d1d5597d4 --- /dev/null +++ b/activerecord/test/connections/frontbase.rb @@ -0,0 +1 @@ +ENV['ARCONN'] = 'frontbase' diff --git a/activerecord/test/connections/jdbc_jdbcderby/connection.rb b/activerecord/test/connections/jdbc_jdbcderby/connection.rb deleted file mode 100644 index 222ef5db38..0000000000 --- a/activerecord/test/connections/jdbc_jdbcderby/connection.rb +++ /dev/null @@ -1,18 +0,0 @@ -print "Using Derby via JRuby, activerecord-jdbc-adapter and activerecord-jdbcderby-adapter\n" -require_dependency 'models/course' -require 'logger' -ActiveRecord::Base.logger = Logger.new("debug.log") - -ActiveRecord::Base.configurations = { - 'arunit' => { - :adapter => 'jdbcderby', - :database => 'activerecord_unittest' - }, - 'arunit2' => { - :adapter => 'jdbcderby', - :database => 'activerecord_unittest2' - } -} - -ActiveRecord::Base.establish_connection 'arunit' -Course.establish_connection 'arunit2' diff --git a/activerecord/test/connections/jdbc_jdbch2/connection.rb b/activerecord/test/connections/jdbc_jdbch2/connection.rb deleted file mode 100644 index 9d2875e8e7..0000000000 --- a/activerecord/test/connections/jdbc_jdbch2/connection.rb +++ /dev/null @@ -1,18 +0,0 @@ -print "Using H2 via JRuby, activerecord-jdbc-adapter and activerecord-jdbch2-adapter\n" -require_dependency 'models/course' -require 'logger' -ActiveRecord::Base.logger = Logger.new("debug.log") - -ActiveRecord::Base.configurations = { - 'arunit' => { - :adapter => 'jdbch2', - :database => 'activerecord_unittest' - }, - 'arunit2' => { - :adapter => 'jdbch2', - :database => 'activerecord_unittest2' - } -} - -ActiveRecord::Base.establish_connection 'arunit' -Course.establish_connection 'arunit2' diff --git a/activerecord/test/connections/jdbc_jdbchsqldb/connection.rb b/activerecord/test/connections/jdbc_jdbchsqldb/connection.rb deleted file mode 100644 index fa943c2c76..0000000000 --- a/activerecord/test/connections/jdbc_jdbchsqldb/connection.rb +++ /dev/null @@ -1,18 +0,0 @@ -print "Using HSQLDB via JRuby, activerecord-jdbc-adapter and activerecord-jdbchsqldb-adapter\n" -require_dependency 'models/course' -require 'logger' -ActiveRecord::Base.logger = Logger.new("debug.log") - -ActiveRecord::Base.configurations = { - 'arunit' => { - :adapter => 'jdbchsqldb', - :database => 'activerecord_unittest' - }, - 'arunit2' => { - :adapter => 'jdbchsqldb', - :database => 'activerecord_unittest2' - } -} - -ActiveRecord::Base.establish_connection 'arunit' -Course.establish_connection 'arunit2' diff --git a/activerecord/test/connections/jdbc_jdbcmysql/connection.rb b/activerecord/test/connections/jdbc_jdbcmysql/connection.rb deleted file mode 100644 index e2517a50eb..0000000000 --- a/activerecord/test/connections/jdbc_jdbcmysql/connection.rb +++ /dev/null @@ -1,26 +0,0 @@ -print "Using MySQL via JRuby, activerecord-jdbc-adapter and activerecord-jdbcmysql-adapter\n" -require_dependency 'models/course' -require 'logger' - -ActiveRecord::Base.logger = Logger.new("debug.log") - -# GRANT ALL PRIVILEGES ON activerecord_unittest.* to 'rails'@'localhost'; -# GRANT ALL PRIVILEGES ON activerecord_unittest2.* to 'rails'@'localhost'; - -ActiveRecord::Base.configurations = { - 'arunit' => { - :adapter => 'jdbcmysql', - :username => 'rails', - :encoding => 'utf8', - :database => 'activerecord_unittest', - }, - 'arunit2' => { - :adapter => 'jdbcmysql', - :username => 'rails', - :database => 'activerecord_unittest2' - } -} - -ActiveRecord::Base.establish_connection 'arunit' -Course.establish_connection 'arunit2' - diff --git a/activerecord/test/connections/jdbc_jdbcpostgresql/connection.rb b/activerecord/test/connections/jdbc_jdbcpostgresql/connection.rb deleted file mode 100644 index 0685da4433..0000000000 --- a/activerecord/test/connections/jdbc_jdbcpostgresql/connection.rb +++ /dev/null @@ -1,26 +0,0 @@ -print "Using Postgrsql via JRuby, activerecord-jdbc-adapter and activerecord-postgresql-adapter\n" -require_dependency 'models/course' -require 'logger' - -ActiveRecord::Base.logger = Logger.new("debug.log") - -# createuser rails --createdb --no-superuser --no-createrole -# createdb -O rails activerecord_unittest -# createdb -O rails activerecord_unittest2 - -ActiveRecord::Base.configurations = { - 'arunit' => { - :adapter => 'jdbcpostgresql', - :username => ENV['USER'] || 'rails', - :database => 'activerecord_unittest' - }, - 'arunit2' => { - :adapter => 'jdbcpostgresql', - :username => ENV['USER'] || 'rails', - :database => 'activerecord_unittest2' - } -} - -ActiveRecord::Base.establish_connection 'arunit' -Course.establish_connection 'arunit2' - diff --git a/activerecord/test/connections/jdbc_jdbcsqlite3/connection.rb b/activerecord/test/connections/jdbc_jdbcsqlite3/connection.rb deleted file mode 100644 index 26d4676ff3..0000000000 --- a/activerecord/test/connections/jdbc_jdbcsqlite3/connection.rb +++ /dev/null @@ -1,25 +0,0 @@ -print "Using SQLite3 via JRuby, activerecord-jdbc-adapter and activerecord-jdbcsqlite3-adapter\n" -require_dependency 'models/course' -require 'logger' -ActiveRecord::Base.logger = Logger.new("debug.log") - -class SqliteError < StandardError -end - -BASE_DIR = FIXTURES_ROOT -sqlite_test_db = "#{BASE_DIR}/fixture_database.sqlite3" -sqlite_test_db2 = "#{BASE_DIR}/fixture_database_2.sqlite3" - -def make_connection(clazz, db_file) - ActiveRecord::Base.configurations = { clazz.name => { :adapter => 'jdbcsqlite3', :database => db_file, :timeout => 5000 } } - unless File.exist?(db_file) - puts "SQLite3 database not found at #{db_file}. Rebuilding it." - sqlite_command = %Q{sqlite3 "#{db_file}" "create table a (a integer); drop table a;"} - puts "Executing '#{sqlite_command}'" - raise SqliteError.new("Seems that there is no sqlite3 executable available") unless system(sqlite_command) - end - clazz.establish_connection(clazz.name) -end - -make_connection(ActiveRecord::Base, sqlite_test_db) -make_connection(Course, sqlite_test_db2) diff --git a/activerecord/test/connections/jdbcderby.rb b/activerecord/test/connections/jdbcderby.rb new file mode 100644 index 0000000000..1c7b63ccdc --- /dev/null +++ b/activerecord/test/connections/jdbcderby.rb @@ -0,0 +1 @@ +ENV['ARCONN'] = 'jdbcderby' diff --git a/activerecord/test/connections/jdbch2.rb b/activerecord/test/connections/jdbch2.rb new file mode 100644 index 0000000000..d2fb177ae3 --- /dev/null +++ b/activerecord/test/connections/jdbch2.rb @@ -0,0 +1 @@ +ENV['ARCONN'] = 'jdbch2' diff --git a/activerecord/test/connections/jdbchsqldb.rb b/activerecord/test/connections/jdbchsqldb.rb new file mode 100644 index 0000000000..22e6d8729e --- /dev/null +++ b/activerecord/test/connections/jdbchsqldb.rb @@ -0,0 +1 @@ +ENV['ARCONN'] = 'jdbchsqldb' diff --git a/activerecord/test/connections/jdbcmysql.rb b/activerecord/test/connections/jdbcmysql.rb new file mode 100644 index 0000000000..f1aaad93a3 --- /dev/null +++ b/activerecord/test/connections/jdbcmysql.rb @@ -0,0 +1 @@ +ENV['ARCONN'] = 'jdbcmysql' diff --git a/activerecord/test/connections/jdbcpostgresql.rb b/activerecord/test/connections/jdbcpostgresql.rb new file mode 100644 index 0000000000..6809115f36 --- /dev/null +++ b/activerecord/test/connections/jdbcpostgresql.rb @@ -0,0 +1 @@ +ENV['ARCONN'] = 'jdbcpostgresql' diff --git a/activerecord/test/connections/jdbcsqlite3.rb b/activerecord/test/connections/jdbcsqlite3.rb new file mode 100644 index 0000000000..9cc872905a --- /dev/null +++ b/activerecord/test/connections/jdbcsqlite3.rb @@ -0,0 +1 @@ +ENV['ARCONN'] = 'jdbcsqlite3' diff --git a/activerecord/test/connections/mysql.rb b/activerecord/test/connections/mysql.rb new file mode 100644 index 0000000000..2f30603098 --- /dev/null +++ b/activerecord/test/connections/mysql.rb @@ -0,0 +1 @@ +ENV['ARCONN'] = 'mysql' diff --git a/activerecord/test/connections/mysql2.rb b/activerecord/test/connections/mysql2.rb new file mode 100644 index 0000000000..10aa9171bd --- /dev/null +++ b/activerecord/test/connections/mysql2.rb @@ -0,0 +1 @@ +ENV['ARCONN'] = 'mysql2' diff --git a/activerecord/test/connections/native_db2/connection.rb b/activerecord/test/connections/native_db2/connection.rb deleted file mode 100644 index 324315d2c8..0000000000 --- a/activerecord/test/connections/native_db2/connection.rb +++ /dev/null @@ -1,25 +0,0 @@ -print "Using native DB2\n" -require_dependency 'models/course' -require 'logger' - -ActiveRecord::Base.logger = Logger.new("debug.log") - -ActiveRecord::Base.configurations = { - 'arunit' => { - :adapter => 'db2', - :host => 'localhost', - :username => 'arunit', - :password => 'arunit', - :database => 'arunit' - }, - 'arunit2' => { - :adapter => 'db2', - :host => 'localhost', - :username => 'arunit', - :password => 'arunit', - :database => 'arunit2' - } -} - -ActiveRecord::Base.establish_connection 'arunit' -Course.establish_connection 'arunit2' diff --git a/activerecord/test/connections/native_firebird/connection.rb b/activerecord/test/connections/native_firebird/connection.rb deleted file mode 100644 index 67a936ca97..0000000000 --- a/activerecord/test/connections/native_firebird/connection.rb +++ /dev/null @@ -1,26 +0,0 @@ -print "Using native Firebird\n" -require_dependency 'models/course' -require 'logger' - -ActiveRecord::Base.logger = Logger.new("debug.log") - -ActiveRecord::Base.configurations = { - 'arunit' => { - :adapter => 'firebird', - :host => 'localhost', - :username => 'rails', - :password => 'rails', - :database => 'activerecord_unittest', - :charset => 'UTF8' - }, - 'arunit2' => { - :adapter => 'firebird', - :host => 'localhost', - :username => 'rails', - :password => 'rails', - :database => 'activerecord_unittest2' - } -} - -ActiveRecord::Base.establish_connection 'arunit' -Course.establish_connection 'arunit2' diff --git a/activerecord/test/connections/native_frontbase/connection.rb b/activerecord/test/connections/native_frontbase/connection.rb deleted file mode 100644 index c01d864a8b..0000000000 --- a/activerecord/test/connections/native_frontbase/connection.rb +++ /dev/null @@ -1,27 +0,0 @@ -puts 'Using native Frontbase' -require_dependency 'models/course' -require 'logger' - -ActiveRecord::Base.logger = Logger.new("debug.log") - -ActiveRecord::Base.configurations = { - 'arunit' => { - :adapter => 'frontbase', - :host => 'localhost', - :username => 'rails', - :password => '', - :database => 'activerecord_unittest', - :session_name => "unittest-#{$$}" - }, - 'arunit2' => { - :adapter => 'frontbase', - :host => 'localhost', - :username => 'rails', - :password => '', - :database => 'activerecord_unittest2', - :session_name => "unittest-#{$$}" - } -} - -ActiveRecord::Base.establish_connection 'arunit' -Course.establish_connection 'arunit2' diff --git a/activerecord/test/connections/native_mysql/connection.rb b/activerecord/test/connections/native_mysql/connection.rb deleted file mode 100644 index 140e06d631..0000000000 --- a/activerecord/test/connections/native_mysql/connection.rb +++ /dev/null @@ -1,25 +0,0 @@ -print "Using native MySQL\n" -require_dependency 'models/course' -require 'logger' - -ActiveRecord::Base.logger = Logger.new("debug.log") - -# GRANT ALL PRIVILEGES ON activerecord_unittest.* to 'rails'@'localhost'; -# GRANT ALL PRIVILEGES ON activerecord_unittest2.* to 'rails'@'localhost'; - -ActiveRecord::Base.configurations = { - 'arunit' => { - :adapter => 'mysql', - :username => 'rails', - :encoding => 'utf8', - :database => 'activerecord_unittest', - }, - 'arunit2' => { - :adapter => 'mysql', - :username => 'rails', - :database => 'activerecord_unittest2' - } -} - -ActiveRecord::Base.establish_connection 'arunit' -Course.establish_connection 'arunit2' diff --git a/activerecord/test/connections/native_mysql2/connection.rb b/activerecord/test/connections/native_mysql2/connection.rb deleted file mode 100644 index c6f198b1ac..0000000000 --- a/activerecord/test/connections/native_mysql2/connection.rb +++ /dev/null @@ -1,25 +0,0 @@ -print "Using native Mysql2\n" -require_dependency 'models/course' -require 'logger' - -ActiveRecord::Base.logger = Logger.new("debug.log") - -# GRANT ALL PRIVILEGES ON activerecord_unittest.* to 'rails'@'localhost'; -# GRANT ALL PRIVILEGES ON activerecord_unittest2.* to 'rails'@'localhost'; - -ActiveRecord::Base.configurations = { - 'arunit' => { - :adapter => 'mysql2', - :username => 'rails', - :encoding => 'utf8', - :database => 'activerecord_unittest', - }, - 'arunit2' => { - :adapter => 'mysql2', - :username => 'rails', - :database => 'activerecord_unittest2' - } -} - -ActiveRecord::Base.establish_connection 'arunit' -Course.establish_connection 'arunit2' diff --git a/activerecord/test/connections/native_openbase/connection.rb b/activerecord/test/connections/native_openbase/connection.rb deleted file mode 100644 index 655cb9ca26..0000000000 --- a/activerecord/test/connections/native_openbase/connection.rb +++ /dev/null @@ -1,21 +0,0 @@ -print "Using native OpenBase\n" -require_dependency 'models/course' -require 'logger' - -ActiveRecord::Base.logger = Logger.new("debug.log") - -ActiveRecord::Base.configurations = { - 'arunit' => { - :adapter => 'openbase', - :username => 'admin', - :database => 'activerecord_unittest', - }, - 'arunit2' => { - :adapter => 'openbase', - :username => 'admin', - :database => 'activerecord_unittest2' - } -} - -ActiveRecord::Base.establish_connection 'arunit' -Course.establish_connection 'arunit2' diff --git a/activerecord/test/connections/native_oracle/connection.rb b/activerecord/test/connections/native_oracle/connection.rb deleted file mode 100644 index 99f921879c..0000000000 --- a/activerecord/test/connections/native_oracle/connection.rb +++ /dev/null @@ -1,35 +0,0 @@ -# uses oracle_enhanced adapter in ENV['ORACLE_ENHANCED_PATH'] or from github.com/rsim/oracle-enhanced.git -require 'active_record/connection_adapters/oracle_enhanced_adapter' - -# otherwise failed with silence_warnings method missing exception -require 'active_support/core_ext/kernel/reporting' - -print "Using Oracle\n" -require_dependency 'models/course' -require 'logger' - -ActiveRecord::Base.logger = Logger.new("debug.log") - -# Set these to your database connection strings -ENV['ARUNIT_DB_NAME'] ||= 'orcl' - -ActiveRecord::Base.configurations = { - 'arunit' => { - :adapter => 'oracle_enhanced', - :database => ENV['ARUNIT_DB_NAME'], - :username => 'arunit', - :password => 'arunit', - :emulate_oracle_adapter => true - }, - 'arunit2' => { - :adapter => 'oracle_enhanced', - :database => ENV['ARUNIT_DB_NAME'], - :username => 'arunit2', - :password => 'arunit2', - :emulate_oracle_adapter => true - } -} - -ActiveRecord::Base.establish_connection 'arunit' -Course.establish_connection 'arunit2' - diff --git a/activerecord/test/connections/native_postgresql/connection.rb b/activerecord/test/connections/native_postgresql/connection.rb deleted file mode 100644 index 3b5ff90003..0000000000 --- a/activerecord/test/connections/native_postgresql/connection.rb +++ /dev/null @@ -1,21 +0,0 @@ -print "Using native PostgreSQL\n" -require_dependency 'models/course' -require 'logger' - -ActiveRecord::Base.logger = Logger.new("debug.log") - -ActiveRecord::Base.configurations = { - 'arunit' => { - :adapter => 'postgresql', - :database => 'activerecord_unittest', - :min_messages => 'warning' - }, - 'arunit2' => { - :adapter => 'postgresql', - :database => 'activerecord_unittest2', - :min_messages => 'warning' - } -} - -ActiveRecord::Base.establish_connection 'arunit' -Course.establish_connection 'arunit2' diff --git a/activerecord/test/connections/native_sqlite3/connection.rb b/activerecord/test/connections/native_sqlite3/connection.rb deleted file mode 100644 index c2aff5551f..0000000000 --- a/activerecord/test/connections/native_sqlite3/connection.rb +++ /dev/null @@ -1,16 +0,0 @@ -print "Using native SQLite3\n" -require_dependency 'models/course' -require 'logger' -ActiveRecord::Base.logger = Logger.new("debug.log") - -BASE_DIR = FIXTURES_ROOT -sqlite_test_db = "#{BASE_DIR}/fixture_database.sqlite3" -sqlite_test_db2 = "#{BASE_DIR}/fixture_database_2.sqlite3" - -def make_connection(clazz, db_file) - ActiveRecord::Base.configurations = { clazz.name => { :adapter => 'sqlite3', :database => db_file, :timeout => 5000 } } - clazz.establish_connection(clazz.name) -end - -make_connection(ActiveRecord::Base, sqlite_test_db) -make_connection(Course, sqlite_test_db2) diff --git a/activerecord/test/connections/native_sqlite3_mem/connection.rb b/activerecord/test/connections/native_sqlite3_mem/connection.rb deleted file mode 100644 index 14e10900d1..0000000000 --- a/activerecord/test/connections/native_sqlite3_mem/connection.rb +++ /dev/null @@ -1,19 +0,0 @@ -# This file connects to an in-memory SQLite3 database, which is a very fast way to run the tests. -# The downside is that disconnect from the database results in the database effectively being -# wiped. For this reason, pooled_connections_test.rb is disabled when using an in-memory database. - -print "Using native SQLite3 (in memory)\n" -require_dependency 'models/course' -require 'logger' -ActiveRecord::Base.logger = Logger.new("debug.log") - -class SqliteError < StandardError -end - -def make_connection(clazz) - ActiveRecord::Base.configurations = { clazz.name => { :adapter => 'sqlite3', :database => ':memory:' } } - clazz.establish_connection(clazz.name) -end - -make_connection(ActiveRecord::Base) -make_connection(Course) diff --git a/activerecord/test/connections/native_sybase/connection.rb b/activerecord/test/connections/native_sybase/connection.rb deleted file mode 100644 index 3282d26922..0000000000 --- a/activerecord/test/connections/native_sybase/connection.rb +++ /dev/null @@ -1,23 +0,0 @@ -print "Using native Sybase Open Client\n" -require_dependency 'models/course' -require 'logger' - -ActiveRecord::Base.logger = Logger.new("debug.log") - -ActiveRecord::Base.configurations = { - 'arunit' => { - :adapter => 'sybase', - :host => 'database_ASE', - :username => 'sa', - :database => 'activerecord_unittest' - }, - 'arunit2' => { - :adapter => 'sybase', - :host => 'database_ASE', - :username => 'sa', - :database => 'activerecord_unittest2' - } -} - -ActiveRecord::Base.establish_connection 'arunit' -Course.establish_connection 'arunit2' diff --git a/activerecord/test/connections/openbase.rb b/activerecord/test/connections/openbase.rb new file mode 100644 index 0000000000..bf072579f4 --- /dev/null +++ b/activerecord/test/connections/openbase.rb @@ -0,0 +1 @@ +ENV['ARCONN'] = 'openbase' diff --git a/activerecord/test/connections/oracle.rb b/activerecord/test/connections/oracle.rb new file mode 100644 index 0000000000..70e92b1424 --- /dev/null +++ b/activerecord/test/connections/oracle.rb @@ -0,0 +1 @@ +ENV['ARCONN'] = 'oracle' diff --git a/activerecord/test/connections/postgresql.rb b/activerecord/test/connections/postgresql.rb new file mode 100644 index 0000000000..b8bfb6e846 --- /dev/null +++ b/activerecord/test/connections/postgresql.rb @@ -0,0 +1 @@ +ENV['ARCONN'] = 'postgresql' diff --git a/activerecord/test/connections/sqlite3.rb b/activerecord/test/connections/sqlite3.rb new file mode 100644 index 0000000000..e5c75657a5 --- /dev/null +++ b/activerecord/test/connections/sqlite3.rb @@ -0,0 +1 @@ +ENV['ARCONN'] = 'sqlite3' diff --git a/activerecord/test/connections/sqlite3_mem.rb b/activerecord/test/connections/sqlite3_mem.rb new file mode 100644 index 0000000000..900a5c7947 --- /dev/null +++ b/activerecord/test/connections/sqlite3_mem.rb @@ -0,0 +1 @@ +ENV['ARCONN'] = 'sqlite3_mem' diff --git a/activerecord/test/connections/sybase.rb b/activerecord/test/connections/sybase.rb new file mode 100644 index 0000000000..7decdf7f39 --- /dev/null +++ b/activerecord/test/connections/sybase.rb @@ -0,0 +1 @@ +ENV['ARCONN'] = 'sybase' -- cgit v1.2.3