Class: RSpec::Matchers::BuiltIn::BeComparedTo Private
- Inherits:
 - 
      BaseMatcher
        
- Object
 - BaseMatcher
 - RSpec::Matchers::BuiltIn::BeComparedTo
 
 
- Defined in:
 - lib/rspec/matchers/built_in/be.rb
 
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Provides the implementation of be <operator> value. Not intended to be instantiated directly.
Constant Summary
Constants inherited from BaseMatcher
RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED
Instance Method Summary collapse
- #description ⇒ String private
 - #failure_message ⇒ String private
 - #failure_message_when_negated ⇒ String private
 - 
  
      #initialize(operand, operator)  ⇒ BeComparedTo 
  
    constructor
  private
    
A new instance of BeComparedTo.
 - #matches?(actual) ⇒ Boolean private
 
Methods inherited from BaseMatcher
#diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?
Methods included from Composable
#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, unreadable_io?, #values_match?
Constructor Details
#initialize(operand, operator) ⇒ BeComparedTo
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of BeComparedTo.
      139 140 141 142 143  | 
    
      # File 'lib/rspec/matchers/built_in/be.rb', line 139 def initialize(operand, operator) @expected = operand @operator = operator @args = [] end  | 
  
Instance Method Details
#description ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
      173 174 175  | 
    
      # File 'lib/rspec/matchers/built_in/be.rb', line 173 def description "be #{@operator} #{expected_to_sentence}#{args_to_sentence}" end  | 
  
#failure_message ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
      154 155 156 157  | 
    
      # File 'lib/rspec/matchers/built_in/be.rb', line 154 def "expected: #{@operator} #{expected_formatted}\n" \ " got: #{@operator.to_s.gsub(/./, ' ')} #{actual_formatted}" end  | 
  
#failure_message_when_negated ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
      161 162 163 164 165 166 167 168 169  | 
    
      # File 'lib/rspec/matchers/built_in/be.rb', line 161 def = "`expect(#{actual_formatted}).not_to " \ "be #{@operator} #{expected_formatted}`" if [:<, :>, :<=, :>=].include?(@operator) + " not only FAILED, it is a bit confusing." else end end  | 
  
#matches?(actual) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
      145 146 147 148 149 150  | 
    
      # File 'lib/rspec/matchers/built_in/be.rb', line 145 def matches?(actual) @actual = actual @actual.__send__ @operator, @expected rescue ArgumentError, NoMethodError false end  |