typealiased / mockingbird

A Swifty mocking framework for Swift and Objective-C.

Home Page:https://mockingbirdswift.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue when stubbing method with callback

thibaultitautomotive opened this issue · comments

New Issue Checklist

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