Class: Knapsack::Adapters::MinitestAdapter
Defined Under Namespace
Modules: BindTimeTrackerMinitestPlugin
Constant Summary
collapse
- TEST_DIR_PATTERN =
'test/**{,/*/**}/*_test.rb'
- REPORT_PATH =
'knapsack_minitest_report.json'
- @@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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/knapsack/adapters/minitest_adapter.rb', line 52
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_report_generator ⇒ Object
#bind_time_offset_warning ⇒ Object
#bind_time_tracker ⇒ Object
#set_test_helper_path(file_path) ⇒ Object
47
48
49
50
|
# File 'lib/knapsack/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
|