From 984b721d1adc506cc76b5b6b2d2b41225452c19b Mon Sep 17 00:00:00 2001 From: dependabot-ci Date: Mon, 15 May 2023 16:23:01 +0100 Subject: [PATCH] (fix) handle case if examples are included above the working directory --- lib/rspec_tracer/source_file.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/rspec_tracer/source_file.rb b/lib/rspec_tracer/source_file.rb index da576ad..ee90f3a 100644 --- a/lib/rspec_tracer/source_file.rb +++ b/lib/rspec_tracer/source_file.rb @@ -25,6 +25,9 @@ def file_name(file_path) end def file_path(file_name) + # return if an absolute path, eg included examples above working directory + return file_name if File.file?(file_name) + # otherwise append root, to get an absolute path. File.expand_path(file_name.sub(%r{^/}, ''), RSpecTracer.root) end end