Skip to content

Commit

Permalink
(fix) handle case if examples are included above the working directory
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot-ci committed May 15, 2023
1 parent 568c5e7 commit 984b721
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/rspec_tracer/source_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 984b721

Please sign in to comment.