sabirvirtuoso / mockit Goto Github PK
View Code? Open in Web Editor NEWA simple mocking framework for Swift, inspired by the famous http://mockito.org/
License: MIT License
A simple mocking framework for Swift, inspired by the famous http://mockito.org/
License: MIT License
I'm curious to know what approach you recommend when trying to verify mocks in an async setup. I'm using Quick/Nimble if that matters.
Does it work at Swift 3.2 and/or Swift 4.0 ?
CocoaPods
is an awesome tool and it makes our life really easier, but there are some devs who still don't know how to use them.
It would be cool to add the Manual installation guide in your README.md
. You can take a look at my iOS Readme Template to see how you can do it.
Presumably nothing in this framework actually depends on iOS - could you possibly mark the podspec as being compatible with OSX too? pod
refuses to install it simply because I'm targeting OSX :)
Greetings!
Have a some problems with testing func, which have call function with a closure parameter inside
MVP architecture, testing non-mock Presenter with mocked ViewController
Presenter - func chooseTypeOfPurpose() {
view.showCategory(purposes: purposes, currentPurpose: currentPurpose) { (otherCategory) in
if let category = otherCategory {
self.setCategory(category)
self.updateButtons()
}
}
}
MockViewController - func showCategory(purposes: [PurposeObject], currentPurpose: PurposeObject?, completion: @escaping (PurposeObject?) -> Void) {
let viewController = PurposeViewController()
viewController.purposeHandler = completion
viewController.allPurposes = purposes
viewController.currentPurpose = currentPurpose;
self.navigationController?.pushViewController(viewController, animated: true)
}
So, what i can do in this situation?
Can i handle completion with Mockit like in Mockito with argumentcaptor?
Is it possible? I'm just starting out and am receiving some build errors that I don't quite understand.
Hello :)
I recently tried to install Mockit via CocoaPods with the following line :
pod 'Mockit', '1.5.0'
Unfortunately, I get the : None of your spec sources contain a spec satisfying the dependency: Mockit (= 1.5.0)
error.
When I go to cocoa pods, the latest version is the 1.4.0 with a compilation error on MockMatcher line 33 (use public instead of open).
I will go with manual installation for now but it would be great if the latest version of the library could be available on Cocoapods for CI :)
Thanks in advance !
Hi,
I need to stub the same method of my mockObject twice, but I can't use the variadic thenReturn because it's a generic method returning different types Single<T.Data> according to the T provided as an argument. (In the code above a Query is a protocol, and the method getSingle<T>(query: T) -> Single<T.Data> where T : Query
accepts any class that implements query and returns a Single of type T.Data)
let _ = self.mockDataSource.when().call(withReturnValue: self.mockDataSource.getSingle(query: QueryA())) .thenReturn(Single.just(payloadA))
let _ = self.mockDataSource .when().call(withReturnValue: self.mockDataSource.getSingle(query: QueryB())) .thenReturn(Single.just(payloadB))
However, the second stub is never called, always the first one, and my tests fail. I'd like to have the ability to create a stub returning a specific type according to the type provided as an argument, either by matching the provided type (I failed to do it with ArgumentMatcher) either by specifying the order...
Thank you for your help,
Recently,i made changes for making the pod compatible with ios8.
Hence,please release new version of pod
Hi,
Is it possible to "mock" a static object or its static functions with Mockit? If yes, how?
Thanks.
Thank you for great effort. is there an example to mock closure?
When is Swift 5 migration planned?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.