UIViewController+RootViewControllerTests.swift 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // UIViewController+RootViewControllerTests.swift
  3. // SheeeeeeeeetTests
  4. //
  5. // Created by Daniel Saidi on 2018-10-17.
  6. // Copyright © 2018 Daniel Saidi. All rights reserved.
  7. //
  8. import Quick
  9. import Nimble
  10. @testable import Sheeeeeeeeet
  11. class UIViewController_RootViewControllerTests: QuickSpec {
  12. override func spec() {
  13. describe("root view controller") {
  14. it("is self if no parent") {
  15. let vc = UIViewController()
  16. expect(vc.rootViewController).to(be(vc))
  17. }
  18. it("is navigation controller if view controller is embedded") {
  19. let vc = UIViewController()
  20. let nvc = UINavigationController(rootViewController: vc)
  21. expect(vc.rootViewController).to(be(nvc))
  22. }
  23. it("is tab bar controller if navigation controller is embedded") {
  24. let vc = UIViewController()
  25. let nvc = UINavigationController(rootViewController: vc)
  26. let tvc = UITabBarController()
  27. tvc.addChild(nvc)
  28. expect(vc.rootViewController).to(be(tvc))
  29. }
  30. }
  31. }
  32. }