Class/Module Index [+]

Quicksearch

RSpec::Matchers::BuiltIn::BeComparedTo

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

Public Class Methods

new(operand, operator) click to toggle source
# File lib/rspec/matchers/built_in/be.rb, line 139
def initialize(operand, operator)
  @expected, @operator = operand, operator
  @args = []
end

Public Instance Methods

description() click to toggle source

@api private @return [String]

# File lib/rspec/matchers/built_in/be.rb, line 168
def description
  "be #{@operator} #{expected_to_sentence}#{args_to_sentence}"
end
failure_message() click to toggle source

@api private @return [String]

# File lib/rspec/matchers/built_in/be.rb, line 151
def failure_message
  "expected: #{@operator} #{@expected.inspect}\n     got: #{@operator.to_s.gsub(/./, ' ')} #{@actual.inspect}"
end
failure_message_when_negated() click to toggle source

@api private @return [String]

# File lib/rspec/matchers/built_in/be.rb, line 157
def failure_message_when_negated
  message = "`expect(#{@actual.inspect}).not_to be #{@operator} #{@expected.inspect}`"
  if [:<, :>, :<=, :>=].include?(@operator)
    message + " not only FAILED, it is a bit confusing."
  else
    message
  end
end
matches?(actual) click to toggle source
# File lib/rspec/matchers/built_in/be.rb, line 144
def matches?(actual)
  @actual = actual
  @actual.__send__ @operator, @expected
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.