forked from dustinvanbuskirk/rails-app-with-knapsack_pro
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_helper.rb
71 lines (57 loc) · 1.6 KB
/
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'minitest/spec'
require 'knapsack_pro'
# CUSTOM_CONFIG_GOES_HERE
KnapsackPro::Hooks::Queue.before_queue do |queue_id|
print '-'*10
print 'Before Queue Hook - run before test suite'
print '-'*10
end
KnapsackPro::Hooks::Queue.after_subset_queue do |queue_id, subset_queue_id|
print '-'*10
print 'After Subset Queue Hook - run after subset of test suite'
print '-'*10
end
KnapsackPro::Hooks::Queue.after_queue do |queue_id|
print '-'*10
print 'After Queue Hook - run after test suite'
print '-'*10
end
knapsack_pro_adapter = KnapsackPro::Adapters::MinitestAdapter.bind
knapsack_pro_adapter.set_test_helper_path(__FILE__)
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
extend MiniTest::Spec::DSL
# Allow context to be used like describe
# This is needed to make minitest spec context work
# in test/minitest/meme_spec_test.rb
class << self
alias :context :describe
end
register_spec_type(self) do |desc|
desc < ActiveRecord::Base if desc.is_a?(Class)
end
end
class Minitest::SharedExamples < Module
include Minitest::Spec::DSL
end
SharedExampleSpec = Minitest::SharedExamples.new do
def setup
sleep 0.1
end
def test_mal
sleep 0.1
assert_equal 4, 2 * 2
end
def test_no_way
sleep 0.2
refute_match(/^no/i, 'yes')
end
def test_that_will_be_skipped
skip 'test this later'
end
end