Sha256: 9c98b33f3d45197a9d1995cdc2de678e8f1086f2a79d3837d1deff43875f8c05

Contents?: true

Size: 1008 Bytes

Versions: 6

Compression:

Stored size: 1008 Bytes

Contents

require 'rubygems'
require 'test/unit'
require 'pp'

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

require 'FileUtils'

gem "activerecord"
require 'active_record'

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

def load_schema
  config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
  ActiveRecord::Base.logger = ActiveSupport::BufferedLogger.new(File.dirname(__FILE__) + "/debug.log")
  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  

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
settler-1.1.1 test/helper.rb
settler-1.1.0 test/helper.rb
settler-1.0.3 test/helper.rb
settler-1.0.2 test/helper.rb
settler-1.0.1 test/helper.rb
settler-1.0.0 test/helper.rb