Issue when stubbing method with callback
thibaultitautomotive opened this issue · comments
thibaultitautomotive commented
New Issue Checklist
- [X ] I updated the framework and generator to the latest version
- [X ] I searched the existing GitHub issues and list of common problems
Overview
Hello,
I have an issue when I try to stub a method with a callback.
When I execute the code bellow the callback data are not populated on my mockOnboardingRepository
Example
given(mockOnboardingRepository.getOnboardingData(any())).will { (callback: ([OnboardingModel]) -> Void) in callback([OnboardingModel.init(picture: R.image.onboarding1, title: "", subtitle: "", isLast: false)]) }
verify(mockOnboardingRepository.getOnboardingData(any())).wasCalled()
--> OK
expectation.fulfill() XCTAssertEqual(sut.output.allData.value.count, 1)
--> No Data on my result array
Expected Behavior
I want to have the data on my repository
Environment
- Mockingbird CLI version (
0.20
) - Xcode and Swift version (
5.5
) - Package manager (CocoaPods)
- Unit testing framework (XCTest)
- Custom configuration
- Mockingbird ignore files
- [ X] Supporting source files