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
func testNavigateToView_loadsView() { | |
let controller = ExampleViewController.loadFromStoryboard() | |
assertThat(controller.view, present()) | |
UIWindow.present(viewController: controller) { () in | |
assertThat(controller.someTextLabel.text, presentAnd(equalTo("Why hello there!"))) | |
} | |
} |
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
public class ExampleViewController: UIViewController { | |
var dependableService: DependableService | |
@IBOutlet var someTextLabel: UITextLabel! | |
class func loadFromStoryboard( | |
dependableService: DependableService) -> ExampleViewController { | |
let controller = UIStoryboard(name:"Main", bundle:NSBundle(forClass:self)) | |
.instantiateViewControllerWithIdentifier("ExampleViewController") | |
as! ExampleViewController |
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
class ExampleViewControllerTest: XCTestCase { | |
class FakeDependableService: DependableService { | |
var lastRequestParameter: String? | |
var stubbedResponse: DependableResponse? | |
init() { | |
super.init() | |
self.lastRequestParameter = "" | |
self.stubbedResponse = nil |
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
class AppEnviroment: NSObject { | |
static let sharedEnvironment = AppEnviroment() | |
let dependableService:DependableService | |
override init() { | |
self.dependableService = DependableService() | |
super.init() |
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 PactConsumerSwift | |
class CandiesMasterDetailFeature: XCTestCase { | |
override func setUp() { | |
super.setUp() | |
continueAfterFailure = false |
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 PactConsumerSwift | |
class CandiesMasterDetailFeature: XCTestCase { | |
override func setUp() { | |
super.setUp() | |
continueAfterFailure = false //So the moment that an assertion in the test fails, we will not continue with the test |
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 | |
@testable import MyExampleApp | |
class ExampleViewControllerTest: XCTestCase { | |
... | |
func testNavigatesToOtherScreen() { |
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
class ExampleViewController: UIViewController { | |
... | |
@IBAction func didTapButtonToGoToOtherViewController(sender: AnyObject) { | |
self.performSegueWithIdentifier("otherViewControllerSegue", sender: nil) | |
} | |
} |
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 UIKit | |
class ExampleViewController: UIViewController { | |
class func loadFromStoryboard(exampleService: ExampleService) -> ExampleViewController { | |
let exampleViewController:ExampleViewController = | |
UIStoryboard(name:"Main", bundle:NSBundle(forClass:self)) | |
.instantiateViewControllerWithIdentifier("ExampleViewController") | |
as! ExampleViewController |
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 { | |
... | |