Sha256: 9a09c7a64a6b9de2d52ebcb49d8fbec4d8c7449dcba5e96e832670f9245a6052

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

# Configure Rails Environment
ENV["RAILS_ENV"] = "test"

puts "TRYING TO USE DB: #{ENV['DB'] || 'default'}"

require File.expand_path("../../test/dummy/config/environment.rb",  __FILE__)
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
ActiveRecord::Migrator.migrations_paths << File.expand_path('../../db/migrate', __FILE__)
require "rails/test_help"

ActiveSupport::TestCase.use_transactional_fixtures = false

puts "USING DB: #{RailsDb::Database.adapter.adapter_name}"
puts "USING Rails: #{Gem.loaded_specs['rails'].version}"

# Filter out Minitest backtrace while allowing backtrace from other libraries
# to be shown.
Minitest.backtrace_filter = Minitest::BacktraceFilter.new

# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }

def clean_db
  if ActiveRecord::Base.connection.table_exists? :t
    ActiveRecord::Base.connection.drop_table :t
  end
  ActiveRecord::Base.connection.tables.map(&:classify).map{|name| name.constantize if Object.const_defined?(name)}.compact.each(&:delete_all)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_db-1.6.0 test/test_helper.rb
rails_db-1.5.0 test/test_helper.rb
rails_db-1.4.1 test/test_helper.rb