Sha256: 99bc0d1c156a998ef77cf8d61338e8268eb5852307b999c0a95448e32478eb12

Contents?: true

Size: 966 Bytes

Versions: 14

Compression:

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

14 entries across 14 versions & 1 rubygems

Version Path
rspeckled-0.0.30 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.29 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.28 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.27 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.26 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.25 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.24 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.23 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.22 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.21 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.20 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.19 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.18 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.17 lib/rspeckled/spec_helpers/active_record_connection_setup.rb