Class: KnapsackPro::Adapters::MinitestAdapter
Defined Under Namespace
Modules: 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
Class Method Details
.test_path(obj) ⇒ Object
7
8
9
10
11
12
13
14
15
16
|
# 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
method_object = obj.method(test_method_name)
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_save_report ⇒ Object
41
42
43
44
45
|
# File 'lib/knapsack_pro/adapters/minitest_adapter.rb', line 41
def bind_save_report
add_post_run_callback do
KnapsackPro::Report.save
end
end
|
#bind_time_tracker ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/knapsack_pro/adapters/minitest_adapter.rb', line 33
def bind_time_tracker
::Minitest::Test.send(:include, BindTimeTrackerMinitestPlugin)
add_post_run_callback do
KnapsackPro.logger.info(KnapsackPro::Presenter.global_time)
end
end
|
#set_test_helper_path(file_path) ⇒ Object
47
48
49
50
|
# File 'lib/knapsack_pro/adapters/minitest_adapter.rb', line 47
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
|