Created
October 28, 2014 20:30
-
-
Save catehstn/390d80d66ee802c383de to your computer and use it in GitHub Desktop.
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
#import <OCMock/OCMock.h> | |
#import <XCTest/XCTest.h> | |
#import "HomeViewController.h" | |
#import "HomeViewPresenter.h" | |
@interface HomeViewControllerTest : XCTestCase { | |
id mockPresenter_; | |
HomeViewController *viewController_; | |
} | |
@end | |
@implementation HomeViewControllerTest | |
- (void)setUp { | |
[super setUp]; | |
mockPresenter_ = OCMStrictClassMock([HomeViewPresenter class]); | |
OCMExpect([mockPresenter_ setViewController:[OCMArg any]]); | |
viewController_ = [[HomeViewController alloc] initWithPresenter:mockPresenter_]; | |
} | |
- (void)testViewLoaded { | |
[viewController_ loadView]; | |
XCTAssertNotNil([viewController_ homeView]); | |
} | |
- (void)testShowImagePickerWithType { | |
id mockNavigationController = OCMStrictClassMock([UINavigationController class]); | |
id mockViewController = [OCMockObject partialMockForObject:viewController_]; | |
[[[mockViewController expect] andReturn:mockNavigationController] navigationController]; | |
OCMExpect([mockNavigationController presentViewController:[OCMArg any] | |
animated:YES | |
completion:nil]); | |
[viewController_ showImagePickerWithType:UIImagePickerControllerSourceTypePhotoLibrary | |
delegate:mockPresenter_]; | |
OCMVerify([mockNavigationController presentViewController:[OCMArg any] | |
animated:YES | |
completion:nil]); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment