From 5fea4f7d1fe03db05aac17ce50af7f95e98fec92 Mon Sep 17 00:00:00 2001 From: Konrad Date: Thu, 7 Nov 2024 16:08:00 +0100 Subject: [PATCH] fix: correct the spec name to prevent overwriting In case of shared examples, line number may be duplicated leading to overwriting the images from other specs --- spec/support/match_reference_image.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/match_reference_image.rb b/spec/support/match_reference_image.rb index 55cf794..f593eba 100644 --- a/spec/support/match_reference_image.rb +++ b/spec/support/match_reference_image.rb @@ -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)