Class: KnapsackPro::Adapters::MinitestAdapter
Defined Under Namespace
Modules: BindQueueModeMinitestPlugin, BindTimeTrackerMinitestPlugin
Constant Summary
collapse
- TEST_DIR_PATTERN =
'test/**{,/*/**}/*_test.rb'
- @@parent_of_test_dir =
nil
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from BaseAdapter
bind, #bind, #bind_before_queue_hook, #bind_save_queue_report, #bind_tracker_reset
Class Method Details
.test_path(obj) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/knapsack_pro/adapters/minitest_adapter.rb', line 7
def self.test_path(obj)
test_method_name = obj.public_methods(false).select{|m| m =~ /^test_/ }.first
if test_method_name.nil?
method_object = obj.method(obj.location.sub(/.*?test_/, 'test_'))
else
method_object = obj.method(test_method_name)
end
full_test_path = method_object.source_location.first
parent_of_test_dir_regexp = Regexp.new("^#{@@parent_of_test_dir}")
test_path = full_test_path.gsub(parent_of_test_dir_regexp, '.')
test_path
end
|
Instance Method Details
#bind_queue_mode ⇒ Object
77
78
79
80
81
82
83
|
# File 'lib/knapsack_pro/adapters/minitest_adapter.rb', line 77
def bind_queue_mode
::Minitest::Test.send(:include, BindQueueModeMinitestPlugin)
add_post_run_callback do
KnapsackPro.logger.debug(KnapsackPro::Presenter.global_time)
end
end
|
#bind_save_report ⇒ Object
46
47
48
49
50
|
# File 'lib/knapsack_pro/adapters/minitest_adapter.rb', line 46
def bind_save_report
add_post_run_callback do
KnapsackPro::Report.save
end
end
|
#bind_time_tracker ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/knapsack_pro/adapters/minitest_adapter.rb', line 38
def bind_time_tracker
::Minitest::Test.send(:include, BindTimeTrackerMinitestPlugin)
add_post_run_callback do
KnapsackPro.logger.debug(KnapsackPro::Presenter.global_time)
end
end
|
#set_test_helper_path(file_path) ⇒ Object
52
53
54
55
|
# File 'lib/knapsack_pro/adapters/minitest_adapter.rb', line 52
def set_test_helper_path(file_path)
test_dir_path = File.dirname(file_path)
@@parent_of_test_dir = File.expand_path('../', test_dir_path)
end
|