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

Methods

Public Class methods

[Source]

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

[Validate]