Class Spy
Wraps a function and records the calls. For each call the arguments and return values are saved.
Methods
Spy:assertCallCount(count) | Test if the spy was called exactly count times. |
Spy:assertCallMatches(query, level) | Test if some calls match specific properties. |
Spy:assertAnyCallMatches(query, level) | Test if at least one call match specific properties. |
Methods
- Spy:assertCallCount(count)
-
Test if the spy was called exactly
count
times.Parameters:
- count
- Spy:assertCallMatches(query, level)
-
Test if some calls match specific properties.
Specify a set of calls to test, by adding: - 'atIndex': Test only the call at the given index. - nothing: Acts as a wildcard and will select all calls.
Specify a set of call attributes to test, by adding: - 'arguments': A list of value matchers, that is compared to the actual arguments. - 'returnValues': A list of value matchers, that is compared to the actual return values.
Parameters:
- query
- level
- Spy:assertAnyCallMatches(query, level)
-
Test if at least one call match specific properties.
Acts like #Spy:assertCallMatches, but succeeds if at least one
call matches.
Parameters:
- query
- level