Skip to content

Commit

Permalink
fix: correct the spec name to prevent overwriting
Browse files Browse the repository at this point in the history
In case of shared examples, line number may be duplicated leading to overwriting the images from other specs
  • Loading branch information
knarewski committed Nov 7, 2024
1 parent 112c0e6 commit 5fea4f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spec/support/match_reference_image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def expose_from(reference_path:, tested_path:, diff_path:)
return true if @normalized_mean_error <= tolerance

metadata = RSpec.current_example.metadata
spec_name = "#{metadata[:absolute_file_path].split('/spec/').last}:#{metadata[:line_number]}"
spec_name = "#{metadata[:absolute_file_path].split('/spec/').last}:#{metadata[:scoped_id]}"
@debug_data = Morandi::SpecSupport::ImageDebugData.new(spec_name, file_type)

@debug_data.expose_from(reference_path: reference_path, tested_path: tested_path, diff_path: tmp_diff.path)
Expand Down

0 comments on commit 5fea4f7

Please sign in to comment.