Comments (1)
You can stub calls to functions having closure parameters which in your case can be for example
let dummyPurposesArray = [PurposeObject] ()
let dummyPurpose = PurposeObject()
let dummyCompletionHandler = { (PurposeObject?) -> Void in }
let stubbedPurposeObject = PurposeObject()
mockViewController.when().call(withReturnValue: mockViewController.showCategory(purposes: dummyPurposesArray, currentPurpose: dummyPurpose, completion: dummyCompletionHandler), andArgumentMatching: [Anything(), Anything(), Anything()]).thenDo { (args: [Any?]) -> Void in
(args[2] as! (PurposeObject?) -> (Void))(stubbedPurposeObject) }
So yes argumentcaptor is possible here like Mockit and you can pass in your desired purposeObject when stubbing.
Hope it helps.
from mockit.
Related Issues (13)
- Add Manual Installation
- How can I mock closure not class HOT 8
- Does it work at Swift 3.2 and/or Swift 4.0 ? HOT 5
- Static mocking? HOT 1
- How to stub the same method twice with different arguments HOT 2
- When is Swift 5 migration planned? HOT 1
- 1.5.0 version unavailable on CocoaPods HOT 1
- Could you update the Swift version?
- OSX Compatibility
- Async HOT 1
- Please release v1.3.3 HOT 2
- Mocking an subclass of ManagedObject HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mockit.