You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Return values can be specified using a `given(_ service:)` clause. There are three return builders available:
199
199
* [`willReturn(_ value:)`](https://kolos65.github.io/Mockable/documentation/mockable/functionreturnbuilder/willreturn(_:)): Will store the given return value and use it to mock subsequent calls.
200
200
* [`willThrow(_ error:)`](https://kolos65.github.io/Mockable/documentation/mockable/throwingfunctionreturnbuilder/willthrow(_:)): Will store the given error and throw it in subsequent calls. Only available for throwing functions and properties.
201
-
* [`willProduce(_ producer)`](https://kolos65.github.io/Mockable/documentation/mockable/throwingfunctionreturnbuilder/willproduce(_:)): Will use the provided closure for mocking. The closure has the same signature as the mocked function, so for example a function that takes an integer returns a string and can throw will accept a closure of type `(Int) throws -> String`.
202
-
* [`willHandle`](https://kolos65.github.io/Mockable/documentation/mockable/throwingfunctionreturnbuilder/willhandle(_:)): Registers a result type that automatically emits a value when successful or throws a failure.
201
+
* [`willProduce(_ producer:)`](https://kolos65.github.io/Mockable/documentation/mockable/throwingfunctionreturnbuilder/willproduce(_:)): Will use the provided closure for mocking. The closure has the same signature as the mocked function, so for example a function that takes an integer returns a string and can throw will accept a closure of type `(Int) throws -> String`.
202
+
* [`willHandle(_ result:)`](https://kolos65.github.io/Mockable/documentation/mockable/throwingfunctionreturnbuilder/willhandle(_:)): Registers a result type that automatically emits a value when successful or throws a failure.
203
203
204
204
The provided return values are used up in FIFO order and the last one is always kept for any further calls. Here are examples of using return clauses:
0 commit comments