Sha256: e94b59de3b5f7f0fc5a905fdbebdba6a719afc61d9c0cbbf3d022f675202cc02

Contents?: true

Size: 967 Bytes

Versions: 49

Compression:

Stored size: 967 Bytes

Contents

# frozen_string_literal: true

require 'active_record'
require 'fileutils'
require 'logger'
require 'yaml'

begin
  FileUtils.mkdir 'log'
rescue Errno::EEXIST
end

log_file                              = File.join(Dir.pwd, 'log', 'activerecord.log')

rails_database_yaml_file_path         = File.join(Dir.pwd, 'config', 'database.yml')
rails_engine_database_yaml_file_path  = File.join(Dir.pwd, 'spec', 'dummy', 'config', 'database.yml')

database_yaml_file_path               = if File.exist? rails_engine_database_yaml_file_path
                                          rails_engine_database_yaml_file_path
                                        else
                                          rails_database_yaml_file_path
                                        end

connection_info                       = YAML.load_file(database_yaml_file_path)['test']

ActiveRecord::Base.logger = Logger.new(log_file)
ActiveRecord::Base.establish_connection(connection_info)

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
rspeckled-1.4.0 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-1.3.1 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-1.3.0 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-1.2.1 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-1.2.0 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-1.1.3 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-1.1.2 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-1.1.1 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-1.1.0 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-1.0.5 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-1.0.4 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-1.0.3 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-1.0.2 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-1.0.1 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-1.0.0 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.64 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.63 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.62 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.61 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.60 lib/rspeckled/spec_helpers/active_record_connection_setup.rb