Merge pull request #999 from kcharwood/new_test_cases

New test cases
This commit is contained in:
Mattt Thompson 2013-05-16 12:45:59 -07:00
commit 211cdfc658

View file

@ -21,7 +21,7 @@
self.baseURL = [NSURL URLWithString:AFNetworkingTestsBaseURLString];
}
- (void)testThatJSONRequestionOperationAcceptsApplicationJSON{
- (void)testThatJSONRequestOperationAcceptsApplicationJSON{
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/response-headers?Content-Type=application/json" relativeToURL:self.baseURL]];
AFJSONRequestOperation *operation = [[AFJSONRequestOperation alloc] initWithRequest:request];
[operation start];
@ -29,7 +29,7 @@
expect(operation.error).will.beNil();
}
- (void)testThatJSONRequestionOperationAcceptsTextJSON{
- (void)testThatJSONRequestOperationAcceptsTextJSON{
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/response-headers?Content-Type=text/json" relativeToURL:self.baseURL]];
AFJSONRequestOperation *operation = [[AFJSONRequestOperation alloc] initWithRequest:request];
[operation start];
@ -37,7 +37,7 @@
expect(operation.error).will.beNil();
}
- (void)testThatJSONRequestionOperationAcceptsTextJavascript{
- (void)testThatJSONRequestOperationAcceptsTextJavascript{
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/response-headers?Content-Type=text/javascript" relativeToURL:self.baseURL]];
AFJSONRequestOperation *operation = [[AFJSONRequestOperation alloc] initWithRequest:request];
[operation start];
@ -45,7 +45,16 @@
expect(operation.error).will.beNil();
}
- (void)testThatJSONRequestionOperationDoesNotAcceptInvalidContentType{
- (void)testThatJSONRequestOperationAcceptsCustomContentType{
[AFJSONRequestOperation addAcceptableContentTypes:[NSSet setWithObject:@"application/customjson"]];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/response-headers?Content-Type=application/customjson" relativeToURL:self.baseURL]];
AFJSONRequestOperation *operation = [[AFJSONRequestOperation alloc] initWithRequest:request];
[operation start];
expect([operation isFinished]).will.beTruthy();
expect(operation.error).will.beNil();
}
- (void)testThatJSONRequestOperationDoesNotAcceptInvalidContentType{
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/response-headers?Content-Type=application/no-json" relativeToURL:self.baseURL]];
AFJSONRequestOperation *operation = [[AFJSONRequestOperation alloc] initWithRequest:request];
[operation start];