Sha256: 8ef50c85a5bf31c824bebf5757778279d465d2eb2a989fe66bca1e75a819d5e6

Contents?: true

Size: 895 Bytes

Versions: 5

Compression:

Stored size: 895 Bytes

Contents

# frozen_string_literal: true

require "active_support/logger"
require "models/college"
require "models/course"
require "models/professor"
require "models/other_dog"

module ARTest
  def self.connection_name
    ENV["ARCONN"] || config["default_connection"]
  end

  def self.test_configuration_hashes
    config.fetch("connections").fetch(connection_name) do
      puts "Connection #{connection_name.inspect} not found. Available connections: #{config['connections'].keys.join(', ')}"
      exit 1
    end
  end

  def self.connect
    ActiveRecord::Base.legacy_connection_handling = false
    puts "Using #{connection_name}"
    ActiveRecord::Base.logger = ActiveSupport::Logger.new("debug.log", 0, 100 * 1024 * 1024)
    ActiveRecord::Base.configurations = test_configuration_hashes
    ActiveRecord::Base.establish_connection :arunit
    ARUnit2Model.establish_connection :arunit2
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ibm_db-5.5.0 test/support/connection.rb
ibm_db-5.4.1 test/support/connection.rb
ibm_db-5.4.0 test/support/connection.rb
ibm_db-5.3.2 test/support/connection.rb
ibm_db-5.3.1 test/support/connection.rb