lib/minitest/utils/reporter.rb in minitest-utils-0.4.1 vs lib/minitest/utils/reporter.rb in minitest-utils-0.4.2
- old
+ new
@@ -116,10 +116,15 @@
io.print str
end
def find_test_file(result)
- location, line = result.method(result.name).source_location
+ location, line = if result.respond_to?(:source_location)
+ result.source_location
+ else
+ result.method(result.name).source_location
+ end
+
location = location.gsub(%r[^.*?/((?:test|spec)/.*?)$], "\\1")
[location, line]
end