Mockingbird Documentation 0.18.0

Function last​Set​Value(initial:​)

public func lastSetValue<DeclarationType: PropertyGetterDeclaration, InvocationType, ReturnType>(
  initial: ReturnType
) -> ImplementationProvider<DeclarationType, InvocationType, ReturnType>  

Stubs a variable getter to return the last value received by the setter.

Getters can be stubbed to automatically save and return values. with property getters to automatically save and return values.

given(bird.name).willReturn(lastSetValue(initial: ""))
print(bird.name)  // Prints ""
bird.name = "Ryan"
print(bird.name)  // Prints "Ryan"

Parameters

initial Return​Type

The initial value to return.