module RSpec::Expectations::ExpectationHelper

def self.handle_failure(matcher, message, failure_message_method)

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?
    ::RSpec::Expectations.fail_with message, matcher.expected, matcher.actual
  else
    ::RSpec::Expectations.fail_with message
  end
end