Last active
January 27, 2017 23:26
-
-
Save chelseatroy/2b4f42707401689ed73ed35c4dc03c68 to your computer and use it in GitHub Desktop.
Load from Storyboard Example iOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XCTest | |
import Hamcrest | |
import FutureKit | |
@testable import MyExampleApp | |
class ExampleViewControllerTest: XCTestCase { | |
... | |
class FakeExampleService: ExampleService { | |
var stubbedResponse: MyExampleAppResponse? | |
var lastRequest: String? | |
override func getResponse(request: String) -> Future<MyExampleAppResponse> { | |
self.lastRequest = request | |
if let stubbedResponse = self.stubbedResponse { | |
return Future(success: stubbedResponse) | |
} | |
return Promise<MyExampleAppResponse>().future | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment