Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Last active January 27, 2017 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chelseatroy/2b4f42707401689ed73ed35c4dc03c68 to your computer and use it in GitHub Desktop.
Save chelseatroy/2b4f42707401689ed73ed35c4dc03c68 to your computer and use it in GitHub Desktop.
Load from Storyboard Example iOS
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