module Aruba::Matchers::BaseMatcher::DefaultFailureMessages

@api private Provides default implementations of failure messages, based on the `description`.

Public Class Methods

has_default_failure_messages?(matcher) click to toggle source

@private rubocop:disable Style/PredicateName

# File lib/aruba/matchers/base/base_matcher.rb, line 76
def self.has_default_failure_messages?(matcher)
  matcher.method(:failure_message).owner == self &&
    matcher.method(:failure_message_when_negated).owner == self
rescue NameError
  false
end

Public Instance Methods

failure_message() click to toggle source

@api private Provides a good generic failure message. Based on `description`. When subclassing, if you are not satisfied with this failure message you often only need to override `description`. @return [String]

# File lib/aruba/matchers/base/base_matcher.rb, line 61
def failure_message
  "expected #{description_of @actual} to #{description}"
end
failure_message_when_negated() click to toggle source

@api private Provides a good generic negative failure message. Based on `description`. When subclassing, if you are not satisfied with this failure message you often only need to override `description`. @return [String]

# File lib/aruba/matchers/base/base_matcher.rb, line 70
def failure_message_when_negated
  "expected #{description_of @actual} not to #{description}"
end