123456789_123456789_123456789_123456789_123456789_

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

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: RSpec::Matchers::BuiltIn::OperatorMatcher
Defined in: rspec-expectations/lib/rspec/matchers/built_in/operators.rb

Overview

Handles operator matcher for ‘should`.

Class Method Summary

Instance Method Summary

Instance Method Details

#__delegate_operator(actual, operator, expected)

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/matchers/built_in/operators.rb', line 98

def __delegate_operator(actual, operator, expected)
  if actual.__send__(operator, expected)
    true
  else
    expected_formatted = RSpec::Support::ObjectFormatter.format(expected)
    actual_formatted   = RSpec::Support::ObjectFormatter.format(actual)

    if ['==', '===', '=~'].include?(operator)
      fail_with_message("expected: #{expected_formatted}\n     got: #{actual_formatted} (using #{operator})")
    else
      fail_with_message("expected: #{operator} #{expected_formatted}\n     got: #{operator.gsub(/./, ' ')} #{actual_formatted}")
    end
  end
end