Mockingbird Documentation 0.14.0

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

mocks Mock

A set of mocks to reset.