Last active
March 5, 2016 21:49
-
-
Save randycoulman/671cfc0f1d21bf681199 to your computer and use it in GitHub Desktop.
Base class for view controller tests in Swift
This file contains 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
@testable import MyApp | |
import UIKit | |
import XCTest | |
class ViewControllerTests: XCTestCase { | |
var storyboard: UIStoryboard! | |
func storyboardName() -> String { | |
return "Main" | |
} | |
override func setUp() { | |
super.setUp() | |
storyboard = UIStoryboard(name: storyboardName(), bundle: nil) | |
} | |
func viewControllerWithIdentifier<T>(identifier: String) -> T { | |
return storyboard.instantiateViewControllerWithIdentifier(identifier) as! T | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment