module RSpec::Matchers::BuiltIn::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

# File lib/rspec/matchers/built_in/base_matcher.rb, line 213
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/rspec/matchers/built_in/base_matcher.rb, line 199
def failure_message
  "expected #{description_of @actual} to #{description}".dup
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/rspec/matchers/built_in/base_matcher.rb, line 208
def failure_message_when_negated
  "expected #{description_of @actual} not to #{description}".dup
end