Skip to content

Commit

Permalink
refactor(DemoTests): lazy var
Browse files Browse the repository at this point in the history
  • Loading branch information
muyexi committed Nov 8, 2018
1 parent 39f2e6d commit c8dc833
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions DemoTests/DemoTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ import XCTest
@testable import Demo

class DemoTests: XCTestCase {
var viewController: ViewController!
lazy var viewController: ViewController = {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main)
let id = String(describing: ViewController.self)

let viewController = storyboard.instantiateViewController(withIdentifier: id) as! ViewController
return viewController
}()

override func setUp() {
super.setUp()

let storyboard = UIStoryboard(name: "Main", bundle: Bundle.main)
let id = String(describing: ViewController.self)

viewController = storyboard.instantiateViewController(withIdentifier: id) as! ViewController
viewController.viewDidLoad()
}

Expand Down

0 comments on commit c8dc833

Please sign in to comment.