Class Spec::Expectations::NegativeExpectationMatcherHandler
In: vendor/plugins/rspec/lib/spec/expectations/handler.rb
Parent: Object

Methods

Included Modules

MatcherHandlerHelper

Public Class methods

[Source]

    # File vendor/plugins/rspec/lib/spec/expectations/handler.rb, line 29
29:         def handle_matcher(actual, matcher, &block)
30:           unless matcher.respond_to?(:matches?)
31:             raise InvalidMatcherError, "Expected a matcher, got #{matcher.inspect}."
32:           end
33: 
34:           unless matcher.respond_to?(:negative_failure_message)
35:             Spec::Expectations.fail_with(
36: "Matcher does not support should_not.\nSee Spec::Matchers for more information\nabout matchers.\n"
37: )
38:           end
39:           match = matcher.matches?(actual, &block)
40:           ::Spec::Matchers.generated_description = "should not #{describe_matcher(matcher)}"
41:           Spec::Expectations.fail_with(matcher.negative_failure_message) if match
42:         end

[Validate]