2011-06-04 18:19:17 -04:00
|
|
|
require 'logger'
|
|
|
|
require_dependency 'models/course'
|
|
|
|
|
|
|
|
module ARTest
|
2011-06-05 06:28:02 -04:00
|
|
|
def self.connection_name
|
|
|
|
ENV['ARCONN'] || config['default_connection']
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.connection_config
|
|
|
|
config['connections'][connection_name]
|
|
|
|
end
|
|
|
|
|
2011-06-04 18:19:17 -04:00
|
|
|
def self.connect
|
|
|
|
puts "Using #{connection_name}"
|
|
|
|
ActiveRecord::Base.logger = Logger.new("debug.log")
|
2011-06-05 06:28:02 -04:00
|
|
|
ActiveRecord::Base.configurations = connection_config
|
2011-06-04 18:19:17 -04:00
|
|
|
ActiveRecord::Base.establish_connection 'arunit'
|
|
|
|
Course.establish_connection 'arunit2'
|
|
|
|
end
|
|
|
|
end
|