Sha256: 4229503e035b68ea80e69310648c6d4ceecf66cabaedfc66be5d2d979142b1bd

Contents?: true

Size: 776 Bytes

Versions: 2

Compression:

Stored size: 776 Bytes

Contents

require 'erb'
require 'active_record'
require 'with_advisory_lock'
require 'database_cleaner'
require 'tmpdir'

db_config = File.expand_path("database.yml", File.dirname(__FILE__))
ActiveRecord::Base.configurations = YAML::load(ERB.new(IO.read(db_config)).result)

def env_db
  ENV["DB"] || "sqlite3"
end

ActiveRecord::Base.establish_connection(env_db)
ActiveRecord::Migration.verbose = false

require 'test_models'
require 'minitest/autorun'
require 'minitest/great_expectations'
require 'mocha/setup'

Thread.abort_on_exception = true

DatabaseCleaner.strategy = :deletion
class MiniTest::Spec
  before do
    ENV['FLOCK_DIR'] = Dir.mktmpdir
    DatabaseCleaner.start
  end
  after do
    DatabaseCleaner.clean
    FileUtils.remove_entry_secure ENV['FLOCK_DIR']
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
with_advisory_lock-0.0.4 test/minitest_helper.rb
with_advisory_lock-0.0.3 test/minitest_helper.rb