Created
March 5, 2013 00:39
-
-
Save zmcartor/5087032 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// beforeEach/afterEach are Kiwi constructs | |
beforeEach(^{ | |
//register as Protocol delegate, the magic begins | |
[NSURLProtocol registerClass:[ILCannedURLProtocol class]]; | |
// Default HTTP status code | |
[ILCannedURLProtocol setCannedStatusCode:200]; | |
// Configure ILtesting only for certain verbs if you like | |
[ILCannedURLProtocol setSupportedMethods:[[NSArray alloc] initWithObjects:@"GET",@"POST", @"PUT", nil]]; | |
// Default headers. Ill be returning JSON here. | |
NSMutableDictionary *headers = [[NSMutableDictionary alloc] init]; | |
[headers setObject:@"application/json; charset=utf-8" forKey:@"Content-Type"]; | |
[ILCannedURLProtocol setCannedHeaders: headers]; | |
}); | |
afterEach(^{ | |
// We must unregister the class after each test. | |
[NSURLProtocol unregisterClass:[ILCannedURLProtocol class]]; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment