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
- .new(message, response, error_generator, backtrace_line = nil) ⇒ SimpleMessageExpectation constructor Internal use only
Instance Attribute Summary
- #called_max_times? ⇒ Boolean readonly Internal use only
Instance Method Summary
- #invoke(*_) Internal use only
- #matches?(message, *_) ⇒ Boolean Internal use only
- #unadvise(_) Internal use only
- #verify_messages_received Internal use only
Instance Attribute Details
#called_max_times? ⇒ Boolean
(readonly)
# 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
# File 'rspec-mocks/lib/rspec/mocks/message_expectation.rb', line 22
def matches?(, *_) @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 return if @received @error_generator.raise_expectation_error( @message, 1, ArgumentListMatcher::MATCH_ALL, 0, nil, [], @backtrace_line ) end