Class/Module Index [+]

Quicksearch

RSpec::Expectations::PositiveExpectationHandler

Public Class Methods

handle_matcher(actual, matcher, message=nil, &block) click to toggle source
# File lib/rspec/expectations/handler.rb, line 18
def self.handle_matcher(actual, matcher, message=nil, &block)
  check_message(message)
  ::RSpec::Matchers.last_should = :should
  ::RSpec::Matchers.last_matcher = matcher
  return ::RSpec::Matchers::BuiltIn::PositiveOperatorMatcher.new(actual) if matcher.nil?

  match = matcher.matches?(actual, &block)
  return match if match

  message = message.call if message.respond_to?(:call)

  message ||= matcher.respond_to?(:failure_message_for_should) ?
              matcher.failure_message_for_should :
              matcher.failure_message

  if matcher.respond_to?(:diffable?) && matcher.diffable?
    ::RSpec::Expectations.fail_with message, matcher.expected, matcher.actual
  else
    ::RSpec::Expectations.fail_with message
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.