aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/connections/jdbc_jdbcsqlite3
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/test/connections/jdbc_jdbcsqlite3
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/test/connections/jdbc_jdbcsqlite3')
-rw-r--r--activerecord/test/connections/jdbc_jdbcsqlite3/connection.rb25
1 files changed, 0 insertions, 25 deletions
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)