Function lastSetValue(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
Name | Type | Description |
---|---|---|
initial | ReturnType |
The initial value to return. |