Sha256: ba1e1dec1f271799c4ae5259283726e0918d4c6277c1817c47dd42dd41863857

Contents?: true

Size: 924 Bytes

Versions: 4

Compression:

Stored size: 924 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

4 entries across 4 versions & 1 rubygems

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