module RSpec::Matchers::BuiltIn::BaseMatcher::DefaultFailureMessages

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

Public Class Methods

@private

# File rspec-expectations/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

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

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