Skip to content

Commit 25347e5

Browse files
committed
Fix compound matcher failure message for RSpec 3.13.0+
1 parent 04d5dc6 commit 25347e5

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
@@ -423,6 +423,26 @@ def from(expected, actual)
423423
new([[expected, text, actual]])
424424
end
425425

426+
def for_many_matchers(matchers)
427+
# Look for expected_for_diff and actual_for_diff if possible
428+
diff_tuples = matchers.map do |m|
429+
expected = if m.respond_to?(:expected_for_diff)
430+
m.expected_for_diff
431+
else
432+
m.expected
433+
end
434+
435+
actual = if m.respond_to?(:actual_for_diff)
436+
m.actual_for_diff
437+
else
438+
m.actual
439+
end
440+
[expected, diff_label_for(m), actual]
441+
end
442+
443+
new(diff_tuples)
444+
end
445+
426446
def colorizer
427447
RSpec::Core::Formatters::ConsoleCodes
428448
end

0 commit comments

Comments
 (0)