Module: RSpec::Expectations::ExpectationHelper Private
Do not use. This module is for internal use only.
Relationships & Source Files | |
Defined in: | rspec-expectations/lib/rspec/expectations/handler.rb |
Class Method Summary
- .check_message(msg) Internal use only
- .handle_failure(matcher, message, failure_message_method) Internal use only
-
.modern_matcher_from(matcher)
Internal use only
Returns an RSpec-3+ compatible matcher, wrapping a legacy one in an adapter if necessary.
- .with_matcher(handler, matcher, message) Internal use only
Class Method Details
.check_message(msg)
[ GitHub ].handle_failure(matcher, message, failure_message_method)
[ GitHub ]# File 'rspec-expectations/lib/rspec/expectations/handler.rb', line 32
def self.handle_failure(matcher, , ) = .call if .respond_to?(:call) ||= matcher.__send__( ) if matcher.respond_to?(:diffable?) && matcher.diffable? ::RSpec::Expectations.fail_with , matcher.expected, matcher.actual else ::RSpec::Expectations.fail_with end end
.modern_matcher_from(matcher)
Returns an RSpec-3+ compatible matcher, wrapping a legacy one in an adapter if necessary.
# File 'rspec-expectations/lib/rspec/expectations/handler.rb', line 18
def self.modern_matcher_from(matcher) LegacyMatcherAdapter::RSpec2.wrap(matcher) || LegacyMatcherAdapter::RSpec1.wrap(matcher) || matcher end
.with_matcher(handler, matcher, message)
[ GitHub ]# File 'rspec-expectations/lib/rspec/expectations/handler.rb', line 23
def self.with_matcher(handler, matcher, ) ( ) matcher = modern_matcher_from(matcher) yield matcher ensure ::RSpec::Matchers.last_expectation_handler = handler ::RSpec::Matchers.last_matcher = matcher end