123456789_123456789_123456789_123456789_123456789_

Module: RSpec::Matchers::BuiltIn::BaseMatcher::DefaultFailureMessages Private

Do not use. This module is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
::RSpec::Matchers::BuiltIn::All, ::RSpec::Matchers::BuiltIn::BaseMatcher, ::RSpec::Matchers::BuiltIn::Be, ::RSpec::Matchers::BuiltIn::BeAKindOf, ::RSpec::Matchers::BuiltIn::BeAnInstanceOf, ::RSpec::Matchers::BuiltIn::BeBetween, ::RSpec::Matchers::BuiltIn::BeComparedTo, ::RSpec::Matchers::BuiltIn::BeFalsey, ::RSpec::Matchers::BuiltIn::BeNil, ::RSpec::Matchers::BuiltIn::BePredicate, ::RSpec::Matchers::BuiltIn::BeTruthy, ::RSpec::Matchers::BuiltIn::BeWithin, ::RSpec::Matchers::BuiltIn::Change, ::RSpec::Matchers::BuiltIn::ChangeFromValue, ::RSpec::Matchers::BuiltIn::ChangeRelatively, ::RSpec::Matchers::BuiltIn::ChangeToValue, ::RSpec::Matchers::BuiltIn::Compound, ::RSpec::Matchers::BuiltIn::Compound::And, ::RSpec::Matchers::BuiltIn::Compound::Or, ::RSpec::Matchers::BuiltIn::ContainExactly, ::RSpec::Matchers::BuiltIn::Cover, ::RSpec::Matchers::BuiltIn::DynamicPredicate, ::RSpec::Matchers::BuiltIn::EndWith, ::RSpec::Matchers::BuiltIn::Eq, ::RSpec::Matchers::BuiltIn::Eql, ::RSpec::Matchers::BuiltIn::Equal, ::RSpec::Matchers::BuiltIn::Exist, ::RSpec::Matchers::BuiltIn::Has, ::RSpec::Matchers::BuiltIn::HaveAttributes, ::RSpec::Matchers::BuiltIn::Include, ::RSpec::Matchers::BuiltIn::Match, ::RSpec::Matchers::BuiltIn::Output, ::RSpec::Matchers::BuiltIn::RespondTo, ::RSpec::Matchers::BuiltIn::Satisfy, ::RSpec::Matchers::BuiltIn::SpecificValuesChange, ::RSpec::Matchers::BuiltIn::StartOrEndWith, ::RSpec::Matchers::BuiltIn::StartWith, ::RSpec::Matchers::BuiltIn::YieldControl, ::RSpec::Matchers::BuiltIn::YieldSuccessiveArgs, ::RSpec::Matchers::BuiltIn::YieldWithArgs, ::RSpec::Matchers::BuiltIn::YieldWithNoArgs, ::RSpec::Matchers::DSL::DefaultImplementations, ::RSpec::Matchers::DSL::Matcher, ::RSpec::Rails::Matchers::ActionCable::HaveBroadcastedTo, ::RSpec::Rails::Matchers::ActionCable::HaveStream, ::RSpec::Rails::Matchers::BeValid
Defined in: rspec-expectations/lib/rspec/matchers/built_in/base_matcher.rb

Overview

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

Class Method Summary

Instance Method Summary

Class Method Details

.has_default_failure_messages?(matcher) ⇒ Boolean

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/matchers/built_in/base_matcher.rb', line 227

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

Instance Method Details

#failure_messageString

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 RSpec::Matchers::BuiltIn::BaseMatcher#description.

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/matchers/built_in/base_matcher.rb', line 213

def failure_message
  "expected #{description_of @actual} to #{description}".dup
end

#failure_message_when_negatedString

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 RSpec::Matchers::BuiltIn::BaseMatcher#description.

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/matchers/built_in/base_matcher.rb', line 222

def failure_message_when_negated
  "expected #{description_of @actual} not to #{description}".dup
end