Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

Latest commit

 

History

History
69 lines (44 loc) · 2.41 KB

README.md

File metadata and controls

69 lines (44 loc) · 2.41 KB

Staged

CI Status codecov Version License Platform

Staged allows you to easily mock View Controllers presentations and dismissals, so you don't have to create a window just to test them.

Usage

Just import #import <Staged/STGViewControllerVerifier.h> and use like this:

STGViewControllerVerifier *verifier = [[STGViewControllerVerifier alloc] init];
UIViewController *viewController = [[UIViewController alloc] init];

// sut is the system under test
[sut presentSomeOtherControllerOn:viewController];

expect(verifier.presenterViewController).to.equal(viewController);
expect(verifier.presentedViewController).to.beKindOf([SomeCoolViewController class]);
expect(verifier.presentedAnimated).to.beTruthy();
expect(verifier.presentedCount).to.equal(1);

This is using Expecta matchers, but you can be boring and use the default ones as well.

You can also check if a view controller was dismissed:

STGViewControllerVerifier *verifier = [[STGViewControllerVerifier alloc] init];

[sut doSomethingThatShouldDismissAViewController];

expect(verifier.dismissedViewController).to.beKindOf([SomeCoolViewController class]);
expect(verifier.dimissedAnimated).to.beFalsy();
expect(verifier.dismissedCount).to.equal(1);

Requirements

iOS 8

Installation

Staged is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "Staged"

Author

Marcelo Fabri, @marcelofabri_

Thanks

Need help?

Please submit an issue on GitHub and provide information about your setup.

License

Staged is available under the MIT license. See the LICENSE file for more info.