class RSpec::Matchers::AliasedNegatedMatcher
def optimal_failure_message(same, inverted)
message is going to be confusing if we return it as-is, as it represents
should return the opposite failure message instead -- the overridden
However, if the override didn't actually change anything, then we
by going through the effort of defining a negated matcher.
includes the phrasing that the user has expressed a preference for
use the override provided by the `description_block`, because it
For a matcher that uses the default failure messages, we prefer to
def optimal_failure_message(same, inverted) if DefaultFailureMessages.has_default_failure_messages?(@base_matcher) base_message = @base_matcher.__send__(same) overridden = @description_block.call(base_message) return overridden if overridden != base_message end @base_matcher.__send__(inverted) end