123456789_123456789_123456789_123456789_123456789_

Class: RSpec::Expectations::LegacyMatcherAdapter::RSpec2 Private

Do not use. This class is for internal use only.

Overview

Starting in ::RSpec 1.2 (and continuing through all 2.x releases), the failure message protocol was:

* `failure_message_for_should`
* `failure_message_for_should_not`

Class Method Summary

Instance Attribute Summary

Instance Method Summary

::RSpec::Matchers::MatcherDelegator - Inherited

::RSpec::Matchers::Composable - Included

#&
#===

Delegates to ‘#matches?`.

#and

Creates a compound ‘and` expectation.

#description_of

Returns the description of the given object in a way that is aware of composed matchers.

#or

Creates a compound ‘or` expectation.

#values_match?

This provides a generic way to fuzzy-match an expected value against an actual value.

#|
#should_enumerate?

We should enumerate arrays as long as they are not recursive.

#surface_descriptions_in

Transforms the given data structure (typically a hash or array) into a new data structure that, when ‘#inspect` is called on it, will provide descriptions of any contained matchers rather than the normal #inspect output.

#unreadable_io?,
#with_matchers_cloned

Historically, a single matcher instance was only checked against a single value.

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RSpec::Matchers::MatcherDelegator

Class Method Details

.interface_matches?(matcher) ⇒ Boolean

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/expectations/handler.rb', line 142

def self.interface_matches?(matcher)
  (
    !matcher.respond_to?(:failure_message) &&
    matcher.respond_to?(:failure_message_for_should)
  ) || (
    !matcher.respond_to?(:failure_message_when_negated) &&
    matcher.respond_to?(:failure_message_for_should_not)
  )
end

Instance Method Details

#failure_message

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/expectations/handler.rb', line 134

def failure_message
  base_matcher.failure_message_for_should
end

#failure_message_when_negated

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/expectations/handler.rb', line 138

def failure_message_when_negated
  base_matcher.failure_message_for_should_not
end