Module: RSpec::Matchers::BuiltIn::BaseMatcher::DefaultFailureMessages Private
Do not use. This module is for internal use only.
Overview
Provides default implementations of failure messages, based on the #description.
Class Method Summary
- .has_default_failure_messages?(matcher) ⇒ Boolean Internal use only
Instance Method Summary
-
#failure_message ⇒ String
Internal use only
Provides a good generic failure message.
-
#failure_message_when_negated ⇒ String
Internal use only
Provides a good generic negative failure message.
Class Method Details
.has_default_failure_messages?(matcher) ⇒ Boolean
# File 'rspec-expectations/lib/rspec/matchers/built_in/base_matcher.rb', line 213
def self. (matcher) matcher.method(: ).owner == self && matcher.method(: ).owner == self rescue NameError false end
Instance Method Details
#failure_message ⇒ String
Provides a good generic failure message. Based on RSpec::Matchers::BuiltIn::BaseMatcher#description. When subclassing, if you are not satisfied with this failure message you often only need to override RSpec::Matchers::BuiltIn::BaseMatcher#description.
# File 'rspec-expectations/lib/rspec/matchers/built_in/base_matcher.rb', line 199
def "expected #{description_of @actual} to #{description}".dup end
#failure_message_when_negated ⇒ String
Provides a good generic negative failure message. Based on RSpec::Matchers::BuiltIn::BaseMatcher#description. When subclassing, if you are not satisfied with this failure message you often only need to override RSpec::Matchers::BuiltIn::BaseMatcher#description.
# File 'rspec-expectations/lib/rspec/matchers/built_in/base_matcher.rb', line 208
def "expected #{description_of @actual} not to #{description}".dup end