2026-03-20 09:55:02 -07:00
|
|
|
# Flag set by Thor coverage task.
|
|
|
|
|
if ENV['COVERAGE'] == 'true'
|
|
|
|
|
require 'simplecov'
|
|
|
|
|
|
|
|
|
|
# Focus only on core app files.
|
|
|
|
|
SimpleCov.add_filter {|src| !(src.filename =~ /\/core\//)}
|
|
|
|
|
|
|
|
|
|
SimpleCov.start 'rails'
|
|
|
|
|
end
|
|
|
|
|
|
2013-10-24 20:25:52 +02:00
|
|
|
ENV['RACK_ENV'] = 'test'
|
|
|
|
|
|
|
|
|
|
require 'bundler/setup'
|
|
|
|
|
Bundler.require :test
|
|
|
|
|
|
|
|
|
|
$LOAD_PATH.unshift 'lib'
|
|
|
|
|
|
|
|
|
|
require 'minitest/autorun'
|
|
|
|
|
require 'minitest/pride'
|
2014-05-12 14:17:55 +02:00
|
|
|
require 'active_support'
|
2013-10-24 20:25:52 +02:00
|
|
|
require 'active_support/core_ext'
|
|
|
|
|
require 'active_support/testing/assertions'
|
|
|
|
|
require 'rr'
|
|
|
|
|
|
|
|
|
|
Dir[File.dirname(__FILE__) + '/support/*.rb'].each do |file|
|
|
|
|
|
autoload File.basename(file, '.rb').camelize, file
|
|
|
|
|
end
|
|
|
|
|
|
2014-12-28 13:59:29 -05:00
|
|
|
ActiveSupport::TestCase.test_order = :random
|
|
|
|
|
|
2024-01-03 18:19:30 +09:00
|
|
|
class Minitest::Spec
|
2013-10-24 20:25:52 +02:00
|
|
|
include ActiveSupport::Testing::Assertions
|
|
|
|
|
|
|
|
|
|
module DSL
|
|
|
|
|
def context(*args, &block)
|
|
|
|
|
describe(*args, &block)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def tmp_path
|
|
|
|
|
$tmp_path ||= mk_tmp
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def mk_tmp
|
|
|
|
|
File.expand_path('../tmp', __FILE__).tap do |path|
|
|
|
|
|
FileUtils.mkdir(path)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def rm_tmp
|
|
|
|
|
FileUtils.rm_rf $tmp_path if $tmp_path
|
|
|
|
|
end
|
|
|
|
|
|
2014-04-13 15:10:40 -04:00
|
|
|
Minitest.after_run do
|
2013-10-24 20:25:52 +02:00
|
|
|
rm_tmp
|
|
|
|
|
end
|