From 523c7c233052a3f3e1ac99adad4aad66f33a9364 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Sun, 5 Jun 2011 11:28:02 +0100 Subject: Fix adapter_test.rb to make no assumptions about the database name --- activerecord/test/support/connection.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'activerecord/test/support/connection.rb') diff --git a/activerecord/test/support/connection.rb b/activerecord/test/support/connection.rb index f4123c694d..fcd2e4dee5 100644 --- a/activerecord/test/support/connection.rb +++ b/activerecord/test/support/connection.rb @@ -2,11 +2,18 @@ require 'logger' require_dependency 'models/course' module ARTest + def self.connection_name + ENV['ARCONN'] || config['default_connection'] + end + + def self.connection_config + config['connections'][connection_name] + end + def self.connect - connection_name = ENV['ARCONN'] || config['default_connection'] puts "Using #{connection_name}" ActiveRecord::Base.logger = Logger.new("debug.log") - ActiveRecord::Base.configurations = config['connections'][connection_name] + ActiveRecord::Base.configurations = connection_config ActiveRecord::Base.establish_connection 'arunit' Course.establish_connection 'arunit2' end -- cgit v1.2.3