20 lines
1.4 KiB
Markdown
20 lines
1.4 KiB
Markdown
# Spies
|
|
When a `double` is instanced, Gut will record calls to methods that are defined in the script or scripts it inherits from. You can then make assertions to check if a method was called, not called, passed certain values, or how many times it was called.
|
|
|
|
You should read the page on doubling before using this, as there are some gotchas with doubling.
|
|
|
|
__You can only spy on methods that have been included in the Double. Built-in functions (such as `set_position`) are not doubled by default, so you cannot spy on them unless you have set the [Double Strategy](Double-Strategy).__
|
|
|
|
## Spy Related Methods
|
|
The following methods can be used to "spy" on doubled objects. They are available in any script that extends [GutTest](class_GutTest).
|
|
<!--
|
|
I could not find any other way to link
|
|
TO an anchor in a page generated from a class ref rst file,
|
|
FROM a page generated by markdown
|
|
-->
|
|
* <a href="class_ref/class_guttest.html#class-guttest-method-assert-called">assert_called</a>
|
|
* <a href="class_ref/class_guttest.html#class-guttest-method-assert-not-called">assert_not_called</a>
|
|
* <a href="class_ref/class_guttest.html#class-guttest-method-assert-called-count">assert_called_count</a>
|
|
* <a href="class_ref/class_guttest.html#class-guttest-method-get-call-parameters">get_call_parameters</a>
|
|
* <a href="class_ref/class_guttest.html#class-guttest-method-get-call-count">get_call_count</a>
|