forked from devxoul/URLNavigator
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: remove stubber code in test code
- Loading branch information
1 parent
6f79012
commit 2ba87b3
Showing
4 changed files
with
61 additions
and
57 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,50 @@ | ||
#if os(iOS) || os(tvOS) | ||
import UIKit | ||
import Stubber | ||
import URLNavigator | ||
|
||
final class StubNavigationController: UINavigationControllerType { | ||
|
||
var pushViewControllerCallCount: Int = 0 | ||
var pushViewControllerParams: (viewController: UIViewController, animated: Bool)? | ||
|
||
func pushViewController(_ viewController: UIViewController, animated: Bool) { | ||
return Stubber.invoke(pushViewController, args: (viewController, animated), default: Void()) | ||
self.pushViewControllerCallCount += 1 | ||
self.pushViewControllerParams = (viewController, animated) | ||
} | ||
} | ||
|
||
final class StubViewController: UIViewControllerType { | ||
|
||
var presentCallCount: Int = 0 | ||
var presentParams: (viewControllerToPresent: UIViewController, animated: Bool, completion: (() -> Void)?)? | ||
|
||
func present(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)?) { | ||
completion?() | ||
return Stubber.invoke(present, args: (viewControllerToPresent, flag, completion), default: Void()) | ||
self.presentCallCount += 1 | ||
self.presentParams = (viewControllerToPresent, flag, completion) | ||
} | ||
} | ||
|
||
final class StubNavigatorDelegate: NavigatorDelegate { | ||
|
||
var shouldPushCallCount: Int = 0 | ||
var shouldPushParams: (viewController: UIViewController, from: UINavigationControllerType)? | ||
var shouldPushStub: Bool = true | ||
|
||
func shouldPush(viewController: UIViewController, from: UINavigationControllerType) -> Bool { | ||
return Stubber.invoke(shouldPush, args: (viewController, from), default: true) | ||
self.shouldPushCallCount += 1 | ||
self.shouldPushParams = (viewController, from) | ||
return self.shouldPushStub | ||
} | ||
|
||
var shouldPresentCallCount: Int = 0 | ||
var shouldPresentParams: (viewController: UIViewController, from: UIViewControllerType)? | ||
var shouldPresentStub: Bool = true | ||
|
||
func shouldPresent(viewController: UIViewController, from: UIViewControllerType) -> Bool { | ||
return Stubber.invoke(shouldPresent, args: (viewController, from), default: true) | ||
self.shouldPresentCallCount += 1 | ||
self.shouldPresentParams = (viewController, from) | ||
return self.shouldPresentStub | ||
} | ||
} | ||
#endif |
This file was deleted.
Oops, something went wrong.