class RSpec::Matchers::BuiltIn::BeComparedTo
Public Class Methods
new(operand, operator)
click to toggle source
# File lib/rspec/matchers/built_in/be.rb, line 99 def initialize(operand, operator) @expected, @operator = operand, operator @args = [] end
Public Instance Methods
description()
click to toggle source
# File lib/rspec/matchers/built_in/be.rb, line 124 def description "be #{@operator} #{expected_to_sentence}#{args_to_sentence}" end
failure_message_for_should()
click to toggle source
# File lib/rspec/matchers/built_in/be.rb, line 109 def failure_message_for_should "expected: #{@operator} #{@expected.inspect}\n got: #{@operator.to_s.gsub(/./, ' ')} #{@actual.inspect}" end
failure_message_for_should_not()
click to toggle source
# File lib/rspec/matchers/built_in/be.rb, line 113 def failure_message_for_should_not message = <<-MESSAGE `#{negative_expectation_expression}` not only FAILED, it is a bit confusing. MESSAGE raise message << ([:===,:==].include?(@operator) ? "It might be more clearly expressed without the \"be\"?" : "It might be more clearly expressed in the positive?") end
matches?(actual)
click to toggle source
# File lib/rspec/matchers/built_in/be.rb, line 104 def matches?(actual) @actual = actual @actual.__send__ @operator, @expected end
negative_expectation_expression()
click to toggle source
# File lib/rspec/matchers/built_in/be.rb, line 128 def negative_expectation_expression Expectations::Syntax.negative_expression("actual", "be #{@operator} #{@expected}") end