AGWaitForAsyncTestHelper
AGWaitForAsyncTestHelper copied to clipboard
Possibility to expect
We should have the possibility to set expectations. Like so:
static NSString *userId = @"asdf";
DummyViewController *viewController = [[DummyViewController alloc] initWithNibName:nil bundle:nil];
AGMockObject *managerMock = [AGMockObject mockForClass:[Manager class]];
[[managerMock expect] fetchDataForUserId:userId]; // we are expecting controller to call this method
viewController.manager = managerMock;
viewController.userId = userId;
/*
We are waiting 0.1 seconds
We expect fetchDataForUserId: to be called with @"asdf" as argument
The trigger block will only trigger the viewController to actually do the expected method-call (example)
*/
[managerMock waitMax:0.1 andExpectWithTrigger:^{
[viewController udpateUser];
}];
alternatively
WAIT_WHILE(![managerMock expectationsFulfilled], 1.0);
[managerMock verify];
This should really be implemented
It could possibly be done with an additional method on OCMockObject ?