class RSpec::Matchers::BuiltIn::BeComparedTo

@api private Provides the implementation of ‘be <operator> value`. Not intended to be instantiated directly.

Public Class Methods

# File rspec-expectations/lib/rspec/matchers/built_in/be.rb, line 139
def initialize(operand, operator)
  @expected = operand
  @operator = operator
  @args = []
end

Public Instance Methods

@api private @return [String]

# File rspec-expectations/lib/rspec/matchers/built_in/be.rb, line 178
def description
  "be #{@operator} #{expected_to_sentence}#{args_to_sentence}"
end
# File rspec-expectations/lib/rspec/matchers/built_in/be.rb, line 151
def does_not_match?(actual)
  !perform_match(actual)
rescue ArgumentError, NoMethodError
  false
end

@api private @return [String]

# File rspec-expectations/lib/rspec/matchers/built_in/be.rb, line 159
def failure_message
  "expected: #{@operator} #{expected_formatted}\n" \
  "     got: #{@operator.to_s.gsub(/./, ' ')} #{actual_formatted}"
end

@api private @return [String]

# File rspec-expectations/lib/rspec/matchers/built_in/be.rb, line 166
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
# File rspec-expectations/lib/rspec/matchers/built_in/be.rb, line 145
def matches?(actual)
  perform_match(actual)
rescue ArgumentError, NoMethodError
  false
end