Function reset(_:)
public func reset(_ mocks: Mock...)
Remove all recorded invocations and configured stubs.
Fully reset a set of mocks during test runs by removing all recorded invocations and clearing all configurations.
let bird = mock(Bird.self)
given(bird.getName()).willReturn("Ryan")
print(bird.name) // Prints "Ryan"
verify(bird.getName()).wasCalled() // Passes
reset(bird)
print(bird.name) // Error: Missing stubbed implementation
verify(bird.getName()).wasCalled() // Error: Got 0 invocations
Parameters
Name | Type | Description |
---|---|---|
mocks | Mock |
A set of mocks to reset. |