Skip to content

Instantly share code, notes, and snippets.

@toco
Created February 28, 2013 10:55
Show Gist options
  • Save toco/5055909 to your computer and use it in GitHub Desktop.
Save toco/5055909 to your computer and use it in GitHub Desktop.
Partial mocking with OCMockito, OCHamcrest sut calls showAlert (verified in debugger) but the test fails
- (void)testShowsAlertViewWhenOpenInSafariFails
{
sut = spy(sut);
// given
[sut view];
UIApplication *application = mock([UIApplication class]);
sut.application = application;
// when
[given([application openURL:sut.url]) willReturnBool:NO];
[sut openInSafari:nil];
// then
[verify(sut) showAlert];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment