Sha256: 6aaf7173b4e78d5e65790ff7139821dcee2cb8d9eab1d2908ebed3ca3806c1ca

Contents?: true

Size: 936 Bytes

Versions: 59

Compression:

Stored size: 936 Bytes

Contents

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

59 entries across 59 versions & 2 rubygems

Version Path
rspectacular-0.70.8 lib/rspectacular/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.16 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.15 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.14 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.13 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.12 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.11 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.10 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.9 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.8 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.7 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.6 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.5 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.4 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspectacular-0.70.7 lib/rspectacular/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.3 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.2 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspeckled-0.0.1 lib/rspeckled/spec_helpers/active_record_connection_setup.rb
rspectacular-0.70.6 lib/rspectacular/spec_helpers/active_record_connection_setup.rb
rspectacular-0.70.5 lib/rspectacular/spec_helpers/active_record_connection_setup.rb