Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Created January 26, 2017 02:32
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/3d3804d58db4151889e57347df5762f7 to your computer and use it in GitHub Desktop.
Save chelseatroy/3d3804d58db4151889e57347df5762f7 to your computer and use it in GitHub Desktop.
Passing Information With Segues Example iOS
import XCTest
import Hamcrest
import FutureKit
@testable import FruitApp
class ListOfFruitsViewControllerTest: XCTestCase {
...
func testShowsFruitDetailsWhenFruitRowIsTapped() {
let orange = FruitAppFruit(name: "Orange")
fruitService.stubbedFruits = [orange]
...
fruitListController.tableView(fruitListController.fruitTableView, didSelectRowAtIndexPath: NSIndexPath(forRow: 0, inSection: 0))
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.001, false)
assertThat(navigationController.topViewController, presentAnd(instanceOf(FruitDetailViewController.self)))
let fruitDetailsController = navigationController.topViewController as! FruitDetailViewController
assertThat(fruitDetailsController.fruit, presentAnd(equalTo(orange)))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment