Class Spec::Matchers::BeComparedTo

  1. lib/spec/matchers/be.rb
Parent: Spec::Matchers::Be

Public class methods

new (operand, operator)
[show source]
# File lib/spec/matchers/be.rb, line 88
      def initialize(operand, operator)
        @expected, @operator = operand, operator
        @args = []
      end

Public instance methods

description ()
[show source]
# File lib/spec/matchers/be.rb, line 114
      def description
        "be #{@operator} #{expected_to_sentence}#{args_to_sentence}"
      end
failure_message_for_should ()
[show source]
# File lib/spec/matchers/be.rb, line 98
      def failure_message_for_should
        "expected #{@operator} #{@expected}, got #{@actual.inspect}"
      end
failure_message_for_should_not ()
[show source]
# File lib/spec/matchers/be.rb, line 102
      def failure_message_for_should_not
        message = "'should_not be \#{@operator} \#{@expected}' not only FAILED,\nit is a bit confusing.\n"
          
        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)
[show source]
# File lib/spec/matchers/be.rb, line 93
      def matches?(actual)
        @actual = actual
        @actual.__send__(@operator, @expected)
      end