Class: RSpec::Expectations::LegacyMatcherAdapter

Inherits:
Matchers::MatcherDelegator show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/expectations/handler.rb

Overview

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

Direct Known Subclasses

RSpec1, RSpec2

Defined Under Namespace

Classes: RSpec1, RSpec2

Instance Attribute Summary

Attributes inherited from Matchers::MatcherDelegator

#base_matcher

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Matchers::MatcherDelegator

#initialize_copy, #method_missing, #respond_to?, #respond_to_missing?

Methods included from Matchers::Composable

#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, unreadable_io?, #values_match?

Constructor Details

#initialize(matcher) ⇒ LegacyMatcherAdapter

Returns a new instance of LegacyMatcherAdapter.



114
115
116
117
118
119
120
121
122
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/expectations/handler.rb', line 114

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) ⇒ Object



124
125
126
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/expectations/handler.rb', line 124

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