Sha256: a328205e025d29fd74843888e74f28e8eef694504e3f9de03ab35ff76c381deb

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

require 'rubygems'
require 'yaml'
require 'minitest/autorun'
#require 'pp'
#require 'debugger'

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))

require 'active_record'

def load_schema
  config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))

  if defined?(ActiveSupport::BufferedLogger)
    ActiveRecord::Base.logger = ActiveSupport::BufferedLogger.new(File.dirname(__FILE__) + "/debug.log")
  else
    ActiveRecord::Base.logger = ActiveSupport::Logger.new(File.dirname(__FILE__) + "/debug.log")
  end

  db_adapter = ENV['DB']
  # no db passed, try one of these fine config-free DBs before bombing.
  db_adapter ||= begin
    require 'rubygems'
    require 'sqlite'
    'sqlite'
  rescue MissingSourceFile
    begin
      require 'sqlite3'
      'sqlite3'
    rescue MissingSourceFile
    end
  end

  if db_adapter.nil?
    raise "No DB Adapter selected. Pass the DB= option to pick one, or install Sqlite or Sqlite3."
  end
  ActiveRecord::Base.establish_connection(config[db_adapter])
  load(File.dirname(__FILE__) + "/schema.rb")
end

load_schema
require File.dirname(__FILE__) + '/../init.rb'
require 'models'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
deep_cloneable-2.0.0 test/test_helper.rb
deep_cloneable-1.7.0 test/test_helper.rb
deep_cloneable-1.6.1 test/test_helper.rb