class RSpec::Matchers::BuiltIn::BeComparedTo
Not intended to be instantiated directly.
Provides the implementation of ‘be <operator> value`.
@api private
def description
-
(String)
-
Other tags:
- Api: - private
def description "be #{@operator} #{expected_to_sentence}#{args_to_sentence}" end
def does_not_match?(actual)
def does_not_match?(actual) !perform_match(actual) rescue ArgumentError, NoMethodError false end
def failure_message
-
(String)
-
Other tags:
- Api: - private
def failure_message "expected: #{@operator} #{expected_formatted}\n" \ " got: #{@operator.to_s.gsub(/./, ' ')} #{actual_formatted}" end
def failure_message_when_negated
-
(String)
-
Other tags:
- Api: - private
def failure_message_when_negated message = "`expect(#{actual_formatted}).not_to " \ "be #{@operator} #{expected_formatted}`" if [:<, :>, :<=, :>=].include?(@operator) message + " not only FAILED, it is a bit confusing." else message end end
def initialize(operand, operator)
def initialize(operand, operator) @expected = operand @operator = operator @args = [] end
def matches?(actual)
def matches?(actual) perform_match(actual) rescue ArgumentError, NoMethodError false end
def perform_match(actual)
def perform_match(actual) @actual = actual @actual.__send__ @operator, @expected end