Class: FlexMock::CallValidator
Overview
A CallValidator checks the list of call records for a particular method name and arguments.
Instance Method Summary collapse
-
#received?(calls, method_name, args, options) ⇒ Boolean
Does the
calls
list record a method namedmethod_name
withargs
.
Instance Method Details
#received?(calls, method_name, args, options) ⇒ Boolean
Does the calls
list record a method named method_name
with args
. Options include:
-
:times => n – If given, the call should match exactly
n
times. -
:and => [] – A list of argument validations to be run on each
matching invocation.
-
:on_count => n – If given, the :and validations on only run on the
nth invocation.
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/flexmock/call_validator.rb', line 27 def received?(calls, method_name, args, ) count = 0 calls.each { |call_record| if call_record.matches?(method_name, args, ) count += 1 run_additional_validations(call_record, count, ) end } count_matches?(count, [:times]) end |