Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 1f2d437

Browse files
committed
Use expanded path to begin with so we don’t have to expand it later.
1 parent a43f596 commit 1f2d437

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

lib/rspec/core/configuration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,7 @@ def load_spec_files
13461346
# isn't loaded by us here so we only know about it because
13471347
# of an example group being registered in it.
13481348
RSpec.world.registered_example_group_files.each do |f|
1349-
loaded_spec_files << File.expand_path(f)
1349+
loaded_spec_files << f # the registered files are already expended absolute paths
13501350
end
13511351

13521352
files_to_run.uniq.each do |f|

lib/rspec/core/metadata.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,13 @@ def populate_location_attributes
147147
end
148148

149149
relative_file_path = Metadata.relative_path(file_path)
150+
absolute_file_path = File.expand_path(relative_file_path)
150151
metadata[:file_path] = relative_file_path
151152
metadata[:line_number] = line_number.to_i
152153
metadata[:location] = "#{relative_file_path}:#{line_number}"
153-
metadata[:absolute_file_path] = File.expand_path(relative_file_path)
154+
metadata[:absolute_file_path] = absolute_file_path
154155
metadata[:rerun_file_path] ||= relative_file_path
155-
metadata[:scoped_id] = build_scoped_id_for(relative_file_path)
156+
metadata[:scoped_id] = build_scoped_id_for(absolute_file_path)
156157
end
157158

158159
def file_path_and_line_number_from(backtrace)

lib/rspec/core/world.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def registered_example_group_files
5050
# Register an example group.
5151
def register(example_group)
5252
example_groups << example_group
53-
@example_group_counts_by_spec_file[example_group.metadata[:file_path]] += 1
53+
@example_group_counts_by_spec_file[example_group.metadata[:absolute_file_path]] += 1
5454
example_group
5555
end
5656

0 commit comments

Comments
 (0)