Sha256: 0d3a9e24e85310601147752302eaff28fc06d0e8edaa0cab21adbe4606f08fa4

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
RAILS_ROOT = File.dirname(__FILE__)

require 'rubygems'
require 'bundler/setup'
require 'minitest/autorun'

require 'active_record'
require 'activerecord-time'
require 'logger'
require 'fileutils'
require 'yaml'

if defined?(Rake) && (RUBY_ENGINE != 'jruby' || org.jruby.RubyInstanceConfig.FULL_TRACE_ENABLED)
  require 'simplecov'
  SimpleCov.start
end

FileUtils.rm_rf File.expand_path(':memory:', File.dirname(__FILE__))
config = YAML.load(File.read(File.dirname(__FILE__) + '/database.yml'))
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + '/test.log')
adapter = ENV['ADAPTER'] || 'sqlite3'
if adapter != 'sqlite3'
  ActiveRecord::Base.establish_connection config[adapter].merge(database: nil)
  begin
    ActiveRecord::Base.connection.drop_database config[adapter][:database]
  rescue => e
    puts e
  end
  begin
    ActiveRecord::Base.connection.create_database config[adapter][:database], charset: 'utf8'
  rescue => e
    puts e
  end
end
ActiveRecord::Base.establish_connection config[adapter]
load(File.dirname(__FILE__) + '/schema.rb') if File.exist?(File.dirname(__FILE__) + '/schema.rb')

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activerecord-time-0.20.0 test/test_helper.rb
activerecord-time-0.19.0 test/test_helper.rb