20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/super_diff/rspec/monkey_patches.rb', line 20
def self.handle_failure(matcher, message, failure_message_method)
message = message.call if message.respond_to?(:call)
message ||= matcher.__send__(failure_message_method)
if matcher.respond_to?(:diffable?) && matcher.diffable?
expected =
if matcher.respond_to?(:expected_for_diff)
matcher.expected_for_diff
else
matcher.expected
end
actual =
if matcher.respond_to?(:actual_for_diff)
matcher.actual_for_diff
else
matcher.actual
end
::RSpec::Expectations.fail_with(message, expected, actual)
else
::RSpec::Expectations.fail_with(message)
end
end
|