Class Spec::Expectations::ExpectationMatcherHandler
In: lib/spec/expectations/handler.rb
Parent: Object

Methods

Included Modules

MatcherHandlerHelper

Public Class methods

[Source]

    # File lib/spec/expectations/handler.rb, line 14
14:         def handle_matcher(actual, matcher, &block)
15:           if :use_operator_matcher == matcher
16:             return Spec::Matchers::PositiveOperatorMatcher.new(actual)
17:           end
18: 
19:           unless matcher.respond_to?(:matches?)
20:             raise InvalidMatcherError, "Expected a matcher, got #{matcher.inspect}."
21:           end
22:           
23:           match = matcher.matches?(actual, &block)
24:           ::Spec::Matchers.generated_description = "should #{describe_matcher(matcher)}"
25:           Spec::Expectations.fail_with(matcher.failure_message) unless match
26:         end

[Validate]