123456789_123456789_123456789_123456789_123456789_

Class: RSpec::Mocks::SimpleMessageExpectation Private

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: rspec-mocks/lib/rspec/mocks/message_expectation.rb

Overview

A message expectation that only allows concrete return values to be set for a message. While this same effect can be achieved using a standard MessageExpectation, this version is much faster and so can be used as an optimization.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#called_max_times?Boolean (readonly)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/message_expectation.rb', line 26

def called_max_times?
  false
end

Instance Method Details

#invoke(*_)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/message_expectation.rb', line 17

def invoke(*_)
  @received = true
  @response
end

#matches?(message, *_) ⇒ Boolean

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/message_expectation.rb', line 22

def matches?(message, *_)
  @message == message.to_sym
end

#unadvise(_)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/message_expectation.rb', line 37

def unadvise(_)
end

#verify_messages_received

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/message_expectation.rb', line 30

def verify_messages_received
  return if @received
  @error_generator.raise_expectation_error(
    @message, 1, ArgumentListMatcher::MATCH_ALL, 0, nil, [], @backtrace_line
  )
end