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

### Methods

handle_matcher

### Included Modules

MatcherHandlerHelper

### Public Class methods

handle_matcher(actual, matcher, &block)

[Source]

        # File lib/spec/expectations/handler.rb, line 33
    33:         def handle_matcher(actual, matcher, &block)
    34:           if :use_operator_matcher == matcher
    35:             return Spec::Matchers::NegativeOperatorMatcher.new(actual)
    36:           end
    37:
    38:           unless matcher.respond_to?(:matches?)
    39:             raise InvalidMatcherError, "Expected a matcher, got #{matcher.inspect}."
    40:           end
    41:
    42:           unless matcher.respond_to?(:negative_failure_message)
    43:             Spec::Expectations.fail_with(
    44: "Matcher does not support should_not.\nSee Spec::Matchers for more information\nabout matchers.\n"
    45: )
    46:           end
    47:           match = matcher.matches?(actual, &block)
    48:           ::Spec::Matchers.generated_description = "should not #{describe_matcher(matcher)}"
    49:           Spec::Expectations.fail_with(matcher.negative_failure_message) if match
    50:         end

[Validate]