forked from freeCodeCamp/devdocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_helper.rb
47 lines (36 loc) · 827 Bytes
/
test_helper.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
ENV['RACK_ENV'] = 'test'
require 'bundler/setup'
Bundler.require :test
$LOAD_PATH.unshift 'lib'
require 'minitest/autorun'
require 'minitest/pride'
require 'active_support'
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
ActiveSupport::TestCase.test_order = :random
class MiniTest::Spec
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
Minitest.after_run do
rm_tmp
end