Class: RSpec::Matchers::BuiltIn::PositiveOperatorMatcher

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

Instance Method Summary (collapse)

Methods inherited from OperatorMatcher

#description, #fail_with_message, get, #initialize, register, registry, unregister, use_custom_matcher_or_delegate, #uses_generic_implementation_of?

Constructor Details

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

Instance Method Details

- (Object) __delegate_operator(actual, operator, expected)

94
95
96
97
98
99
100
101
102
# File 'lib/rspec/matchers/operator_matcher.rb', line 94
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