diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-07-10 19:27:04 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-07-10 19:27:04 +0000 |
commit | 41f3b7ab56d1c90454c0c5db6cbf3e8982ac0f34 (patch) | |
tree | b580ea8b2672442652bb9c3c527809da570b03eb /activerecord/test/connections/native_sqlite3 | |
parent | 5ad4f1ad94c71bfbb6aacc8a27addc4a0de54506 (diff) | |
download | rails-41f3b7ab56d1c90454c0c5db6cbf3e8982ac0f34.tar.gz rails-41f3b7ab56d1c90454c0c5db6cbf3e8982ac0f34.tar.bz2 rails-41f3b7ab56d1c90454c0c5db6cbf3e8982ac0f34.zip |
Test connections use AR::Base.configurations. References #5497.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4602 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/connections/native_sqlite3')
-rw-r--r-- | activerecord/test/connections/native_sqlite3/connection.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/activerecord/test/connections/native_sqlite3/connection.rb b/activerecord/test/connections/native_sqlite3/connection.rb index 182ec6ba68..008ea686d6 100644 --- a/activerecord/test/connections/native_sqlite3/connection.rb +++ b/activerecord/test/connections/native_sqlite3/connection.rb @@ -11,14 +11,13 @@ sqlite_test_db = "#{BASE_DIR}/fixture_database.sqlite3" sqlite_test_db2 = "#{BASE_DIR}/fixture_database_2.sqlite3" def make_connection(clazz, db_file, db_definitions_file) + ActiveRecord::Base.configurations = { clazz.name => { :adapter => 'sqlite3', :database => db_file } } 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) - clazz.establish_connection( - :adapter => "sqlite3", - :database => db_file) + clazz.establish_connection(clazz.name) script = File.read("#{BASE_DIR}/db_definitions/#{db_definitions_file}") # SQLite-Ruby has problems with semi-colon separated commands, so split and execute one at a time script.split(';').each do @@ -26,9 +25,7 @@ def make_connection(clazz, db_file, db_definitions_file) clazz.connection.execute(command) unless command.strip.empty? end else - clazz.establish_connection( - :adapter => "sqlite3", - :database => db_file) + clazz.establish_connection(clazz.name) end end |