Created
September 14, 2012 21:10
-
-
Save ejeffers/3724858 to your computer and use it in GitHub Desktop.
Async Unit Tests with Blocks - turns out, OCUnit doesn't provide a runLoop or anything like - so you gotta make your own
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
- (void)testFetchCrumbsForStartTime | |
{ | |
[NSRunLoop currentRunLoop]; | |
// use the downloader to "download" the data | |
UMEPGQueryManager *queryMan = [[UMEPGQueryManager alloc] init]; | |
__block BOOL isDone = NO; | |
//Makes calls to several blocks, on different threads | |
[queryMan fetchChannelIdsWithCompletionHandler:^(NSArray *channelIds) { | |
//Verify results here | |
STAssertEquals(channelIds, verifiedChannelIds, @"your log message here"); | |
isDone = YES; | |
}]; | |
while (!isDone) { | |
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment