Class: RSpec::Expectations::LegacyMatcherAdapter::RSpec1

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

Before RSpec 1.2, the failure message protocol was:

* `failure_message`
* `negative_failure_message`

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

Note: ‘failure_message` is part of the RSpec 3 protocol (paired with `failure_message_when_negated`), so we don’t check for ‘failure_message` here.

Returns:

  • (Boolean)


169
170
171
172
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/expectations/handler.rb', line 169

def self.interface_matches?(matcher)
  !matcher.respond_to?(:failure_message_when_negated) &&
  matcher.respond_to?(:negative_failure_message)
end

Instance Method Details

#failure_messageObject



158
159
160
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/expectations/handler.rb', line 158

def failure_message
  base_matcher.failure_message
end

#failure_message_when_negatedObject



162
163
164
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/expectations/handler.rb', line 162

def failure_message_when_negated
  base_matcher.negative_failure_message
end