123456789_123456789_123456789_123456789_123456789_

Class: RSpec::Expectations::LegacyMatcherAdapter Private

Relationships & Source Files
Namespace Children
Classes:
Extension / Inclusion / Inheritance Descendants
Subclasses:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: RSpec::Matchers::MatcherDelegator
Defined in: rspec-expectations/lib/rspec/expectations/handler.rb

Overview

Wraps a matcher written against one of the legacy protocols in order to present the current protocol.

Class Method Summary

::RSpec::Matchers::MatcherDelegator - Inherited

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.

Constructor Details

.new(matcher) ⇒ LegacyMatcherAdapter

[ GitHub ]

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

def initialize(matcher)
  super
  ::RSpec.warn_deprecation(<<-EOS.gsub(/^\s+\|/, ''), :type => "legacy_matcher")
    |#{matcher.class.name || matcher.inspect} implements a legacy RSpec matcher
    |protocol. For the current protocol you should expose the failure messages
    |via the `failure_message` and `failure_message_when_negated` methods.
    |(Used from #{CallerFilter.first_non_rspec_line})
  EOS
end

Dynamic Method Handling

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

Class Method Details

.wrap(matcher)

[ GitHub ]

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

def self.wrap(matcher)
  new(matcher) if interface_matches?(matcher)
end