Mockingbird Documentation 0.17.0

Function clear​Invocations(on:​)

public func clearInvocations(on mocks: Mock...)  

Remove all recorded invocations.

Partially reset a set of mocks during test runs by removing all recorded invocations.

let bird = mock(Bird.self)
given(bird.getName()).willReturn("Ryan")

print(bird.name)  // Prints "Ryan"
verify(bird.getName()).wasCalled()  // Passes

clearInvocations(on: bird)

print(bird.name)  // Prints "Ryan"
verify(bird.getName()).wasCalled()  // Error: Got 0 invocations

Parameters

mocks Mock

A set of mocks to reset.