Created
August 11, 2016 17:49
-
-
Save JoelJWest/10d5b1afcd4cebe7ca39070d9b525a62 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| - (void)testAnArgument { | |
| NSString *const labelText = @"Label Text"; | |
| NSString *const title = @"Title"; | |
| NSString *const backgroundImageName = @"Image Name"; | |
| UINavigationController *navController = [UINavigationController new]; | |
| BNPayeeCreateTaskController *taskController = [BNPayeeCreateTaskController new]; | |
| BOOL (^validator)(BNTaskWaitViewController *) = ^(BNTaskWaitViewController *waitController) { | |
| BOOL isCorrectClass = [waitController isKindOfClass:[BNTaskWaitViewController class]]; | |
| XCTAssertTrue(waitController.delegate == taskController, | |
| @"The waitController's delegate was not assigned correctly"); | |
| XCTAssertTrue(waitController.widthConstrained, | |
| @"The waitController should be constrained in width"); | |
| XCTAssertEqualObjects(waitController.title, title, | |
| @"The waitController's title was not assigned correctly"); | |
| XCTAssertEqualObjects(waitController.labelText, labelText, | |
| @"The waitController's labelText was not assigned correctly"); | |
| XCTAssertEqualObjects(waitController.backgroundImageName, backgroundImageName, | |
| @"the waitController's backgroundImageName was not assigned correctly"); | |
| return isCorrectClass; | |
| }; | |
| id mockTaskController = OCMPartialMock(taskController); | |
| OCMExpect([mockTaskController navigationController]).andReturn(navController); | |
| OCMExpect([mockTaskController currentStepTitle]).andReturn(title); | |
| OCMExpect([mockTaskController backgroundImageName]).andReturn(backgroundImageName); | |
| id mockNavController = OCMPartialMock(navController); | |
| OCMExpect([mockNavController pushViewController:[OCMArg checkWithBlock:validator] animated:NO]); | |
| [taskController pushWaitControllerWithLabel:labelText]; | |
| OCMVerifyAll(mockTaskController); | |
| OCMVerifyAll(mockNavController); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment