Skip to content

Instantly share code, notes, and snippets.

@ecgreb
Last active December 17, 2015 03:19
Show Gist options
  • Save ecgreb/5542116 to your computer and use it in GitHub Desktop.
Save ecgreb/5542116 to your computer and use it in GitHub Desktop.
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