aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/support/connection.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/support/connection.rb')
-rw-r--r--activerecord/test/support/connection.rb11
1 files changed, 9 insertions, 2 deletions
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