valnoc/Mirage

Then return nil as parameter

vlchapaev opened this issue · 0 comments

Stubbed function should be allow tor return 'nil'. Suggest to make result param optional.

Mirage/Mirage/Stub.swift

Lines 45 to 56 in a5d3150

/// Returns new result instead of default
///
/// - Parameter result: New result.
/// - Returns: A stub for chained call.
@discardableResult
public func thenReturn(_ result: Any) -> Stub {
let stubAction = StubAction { (_) -> Any? in
return result
}
actions.append(stubAction)
return self
}