Skip to content

Commit 29b7e36

Browse files
committed
Fix compound matcher failure message for RSpec < 3.13.0
1 parent 25347e5 commit 29b7e36

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lib/super_diff/rspec/monkey_patches.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,26 @@ def from(expected)
352352
new([[expected, text]])
353353
end
354354

355+
def for_many_matchers(matchers)
356+
# Look for expected_for_diff and actual_for_diff if possible
357+
diff_tuples = matchers.map do |m|
358+
expected = if m.respond_to?(:expected_for_diff)
359+
m.expected_for_diff
360+
else
361+
m.expected
362+
end
363+
364+
actual = if m.respond_to?(:actual_for_diff)
365+
m.actual_for_diff
366+
else
367+
m.actual
368+
end
369+
[expected, diff_label_for(m), actual]
370+
end
371+
372+
new(diff_tuples)
373+
end
374+
355375
def colorizer
356376
RSpec::Core::Formatters::ConsoleCodes
357377
end

0 commit comments

Comments
 (0)