Class Spec::Expectations::ExpectationMatcherHandler
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 7
 7:         def handle_matcher(actual, matcher, &block)
 8:           ::Spec::Matchers.last_should = "should"
 9:           return Spec::Matchers::PositiveOperatorMatcher.new(actual) if matcher.nil?
10: 
11:           unless matcher.respond_to?(:matches?)
12:             raise InvalidMatcherError, "Expected a matcher, got #{matcher.inspect}."
13:           end
14:           
15:           match = matcher.matches?(actual, &block)
16:           ::Spec::Matchers.last_matcher = matcher
17:           Spec::Expectations.fail_with(matcher.failure_message) unless match
18:           match
19:         end

[Validate]