Class: RSpec::Mocks::SimpleMessageExpectation
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/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.
Instance Method Summary collapse
- #called_max_times? ⇒ Boolean
-
#initialize(message, response, error_generator, backtrace_line = nil) ⇒ SimpleMessageExpectation
constructor
A new instance of SimpleMessageExpectation.
- #invoke(*_) ⇒ Object
- #matches?(message, *_) ⇒ Boolean
- #unadvise(_) ⇒ Object
- #verify_messages_received ⇒ Object
Constructor Details
#initialize(message, response, error_generator, backtrace_line = nil) ⇒ SimpleMessageExpectation
Returns a new instance of SimpleMessageExpectation.
12 13 14 15 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/message_expectation.rb', line 12 def initialize(, response, error_generator, backtrace_line=nil) @message, @response, @error_generator, @backtrace_line = .to_sym, response, error_generator, backtrace_line @received = false end |
Instance Method Details
#called_max_times? ⇒ Boolean
26 27 28 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/message_expectation.rb', line 26 def called_max_times? false end |
#invoke(*_) ⇒ Object
17 18 19 20 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/message_expectation.rb', line 17 def invoke(*_) @received = true @response end |
#matches?(message, *_) ⇒ Boolean
22 23 24 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/message_expectation.rb', line 22 def matches?(, *_) @message == .to_sym end |
#unadvise(_) ⇒ Object
37 38 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/message_expectation.rb', line 37 def unadvise(_) end |
#verify_messages_received ⇒ Object
30 31 32 33 34 35 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/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 |