Class: Spec::Matchers::PositiveOperatorMatcher

Inherits:
BaseOperatorMatcher show all
Defined in:
lib/spec/matchers/operator_matcher.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from BaseOperatorMatcher

#<, #<=, #==, #===, #=~, #>, #>=, #fail_with_message, #initialize

Constructor Details

This class inherits a constructor from Spec::Matchers::BaseOperatorMatcher

Instance Method Details

#__delegate_method_missing_to_target(operator, expected) ⇒ Object



52
53
54
55
56
57
# File 'lib/spec/matchers/operator_matcher.rb', line 52

def __delegate_method_missing_to_target(operator, expected)
  ::Spec::Matchers.generated_description = "should #{operator} #{expected.inspect}"
  return if @target.send(operator, expected)
  return fail_with_message("expected: #{expected.inspect},\n     got: #{@target.inspect} (using #{operator})") if ['==','===', '=~'].include?(operator)
  return fail_with_message("expected: #{operator} #{expected.inspect},\n     got: #{operator.gsub(/./, ' ')} #{@target.inspect}")
end