Class: RSpec::Matchers::PositiveOperatorMatcher

Inherits:
OperatorMatcher show all
Defined in:
lib/rspec/matchers/operator_matcher.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from OperatorMatcher

#description, #fail_with_message, get, #initialize, register, registry, use_custom_matcher_or_delegate

Constructor Details

This class inherits a constructor from RSpec::Matchers::OperatorMatcher

Instance Method Details

#__delegate_operator(actual, operator, expected) ⇒ Object



57
58
59
60
61
62
63
64
65
# File 'lib/rspec/matchers/operator_matcher.rb', line 57

def __delegate_operator(actual, operator, expected)
  if actual.__send__(operator, expected)
    true
  elsif ['==','===', '=~'].include?(operator)
    fail_with_message("expected: #{expected.inspect},\n     got: #{actual.inspect} (using #{operator})") 
  else
    fail_with_message("expected: #{operator} #{expected.inspect},\n     got: #{operator.gsub(/./, ' ')} #{actual.inspect}")
  end
end