Last active
December 17, 2015 03:19
-
-
Save ecgreb/5542116 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
SPEC_BEGIN(HelloTDDViewControllerSpec) | |
describe(@"HelloTDDViewController", ^{ | |
HelloTDDViewController *viewController = | |
[[HelloTDDViewController alloc] init]; | |
MockHelloTDDViewControllerDelegate *delegate = | |
[[MockHelloTDDViewControllerDelegate alloc] init]; | |
//... | |
context(@"when button is pressed", ^{ | |
it(@"should notify delegate.", ^{ | |
viewController.delegate = delegate; | |
[viewController onButtonClick:nil]; | |
[[theValue(delegate.buttonWasClicked) should] beYes]; | |
}); | |
it(@"should pass name to delegate.", ^{ | |
viewController.delegate = delegate; | |
UITextField *textField = [[UITextField alloc] init]; | |
textField.text = @"First Last"; | |
viewController.nameField = textField; | |
[viewController onButtonClick:nil]; | |
[[delegate.lastNameSent should] equal:@"First Last"]; | |
}); | |
}); | |
//... | |
}); | |
SPEC_END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment