Skip to content

Instantly share code, notes, and snippets.

@JoelJWest
Created August 11, 2016 17:50
Show Gist options
  • Save JoelJWest/e534060af06b56425a6e1e7957c14126 to your computer and use it in GitHub Desktop.
Save JoelJWest/e534060af06b56425a6e1e7957c14126 to your computer and use it in GitHub Desktop.
- (void)testCompleteEnrollment {
BNRemoteDepositStartViewController *const startController = [BNRemoteDepositStartViewController new];
__block UIAlertController *alertController;
BNValidateBlock validator = extractArgTo(alertController);
id mockController = OCMPartialMock(startController);
[mockController setExpectationOrderMatters:YES];
OCMExpect([mockController setShouldShowSignUpSubmitted:YES]);
OCMExpect([mockController presentViewController:[OCMArg checkWithBlock:validator]
animated:YES
completion:nil]);
[startController completeEnrollment:^{}];
NSString *expectedTitle;
expectedTitle = NSLocalizedString(@"Thank You", nil);
NSString *const expectedMessage =
NSLocalizedString(@"Your request is being processed. A notification will be sent as soon as your accounts have been approved.",
nil);
XCTAssertEqualObjects(alertController.title, expectedTitle, @"The alert controller title is incorrect");
XCTAssertEqualObjects(alertController.message, expectedMessage,
@"The alert controller message is incorrect");
XCTAssertEqual(alertController.preferredStyle, UIAlertControllerStyleAlert,
@"The alert controller style is incorrect");
XCTAssertEqual(alertController.actions.count, 1, @"Expected the alert controller to have one action");
UIAlertAction *const action = alertController.actions[0];
expectedTitle = NSLocalizedString(@"OK", nil);
XCTAssertEqualObjects(action.title, expectedTitle, @"The title for action 0 is incorrect");
XCTAssertEqual(action.style, UIAlertActionStyleDefault, @"The style for action 0 is incorrect");
OCMVerifyAll(mockController);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment