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

Inherits:
RSpec::Expectations::LegacyMatcherAdapter 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

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`

Instance Attribute Summary

Attributes inherited from Matchers::MatcherDelegator

#base_matcher

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RSpec::Expectations::LegacyMatcherAdapter

#initialize, wrap

Methods inherited from Matchers::MatcherDelegator

#initialize, #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

This class inherits a constructor from RSpec::Expectations::LegacyMatcherAdapter

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

Returns:

  • (Boolean)


142
143
144
145
146
147
148
149
150
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/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_messageObject



134
135
136
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/expectations/handler.rb', line 134

def failure_message
  base_matcher.failure_message_for_should
end

#failure_message_when_negatedObject



138
139
140
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/expectations/handler.rb', line 138

def failure_message_when_negated
  base_matcher.failure_message_for_should_not
end