Created
November 14, 2012 18:04
-
-
Save 0xc010d/4073713 to your computer and use it in GitHub Desktop.
OHHTTPStubs example
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
[OHHTTPStubs addRequestHandler:^OHHTTPStubsResponse *(NSURLRequest *request, BOOL onlyCheck) { | |
NSData *responseData = [@"[]" dataUsingEncoding:NSUTF8StringEncoding]; | |
return [OHHTTPStubsResponse responseWithData:responseData statusCode:200 responseTime:1 headers:@{}]; | |
}]; | |
__block BOOL done = NO; | |
[[CheckOperation checkOperationForJobWithURLString:@"" username:@"" password:@"" completionBlock:^(NSNumber *buildNumber, kJobStatus status, NSError *error) { | |
STAssertNil(error, @"error should be nill for '[]'"); | |
STAssertNil(buildNumber, @"buildNumber should be nill for '[]'"); | |
STAssertEquals(status, kJobStatusUnknown, @"status should be Unknown for '[]'"); | |
done = YES; | |
}] start]; | |
while (!done) { | |
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; | |
} | |
[OHHTTPStubs removeLastRequestHandler]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment