Minor formatting

This commit is contained in:
Mattt Thompson 2013-05-31 09:52:32 -07:00
parent 5c712c13ad
commit b26df2e6aa

View file

@ -69,15 +69,15 @@
expect([AFJSONRequestOperation canProcessRequest:request]).to.beTruthy();
AFHTTPRequestOperation *operation = [self.client HTTPRequestOperationWithRequest:request success:NULL failure:NULL];
AFHTTPRequestOperation *operation = [self.client HTTPRequestOperationWithRequest:request success:nil failure:nil];
expect([operation class]).to.equal([AFHTTPRequestOperation class]);
[self.client registerHTTPOperationClass:[AFJSONRequestOperation class]];
operation = [self.client HTTPRequestOperationWithRequest:request success:NULL failure:NULL];
operation = [self.client HTTPRequestOperationWithRequest:request success:nil failure:nil];
expect([operation class]).to.equal([AFJSONRequestOperation class]);
[self.client unregisterHTTPOperationClass:[AFJSONRequestOperation class]];
operation = [self.client HTTPRequestOperationWithRequest:request success:NULL failure:NULL];
operation = [self.client HTTPRequestOperationWithRequest:request success:nil failure:nil];
expect([operation class]).to.equal([AFHTTPRequestOperation class]);
}
@ -87,11 +87,11 @@
expect([AFXMLRequestOperation canProcessRequest:request]).to.beTruthy();
AFHTTPRequestOperation *operation = [self.client HTTPRequestOperationWithRequest:request success:NULL failure:NULL];
AFHTTPRequestOperation *operation = [self.client HTTPRequestOperationWithRequest:request success:nil failure:nil];
expect([operation class]).to.equal([AFHTTPRequestOperation class]);
[self.client registerHTTPOperationClass:[AFXMLRequestOperation class]];
operation = [self.client HTTPRequestOperationWithRequest:request success:NULL failure:NULL];
operation = [self.client HTTPRequestOperationWithRequest:request success:nil failure:nil];
expect([operation class]).to.equal([AFXMLRequestOperation class]);
}
@ -101,11 +101,11 @@
expect([AFImageRequestOperation canProcessRequest:request]).to.beTruthy();
AFHTTPRequestOperation *operation = [self.client HTTPRequestOperationWithRequest:request success:NULL failure:NULL];
AFHTTPRequestOperation *operation = [self.client HTTPRequestOperationWithRequest:request success:nil failure:nil];
expect([operation class]).to.equal([AFHTTPRequestOperation class]);
[self.client registerHTTPOperationClass:[AFImageRequestOperation class]];
operation = [self.client HTTPRequestOperationWithRequest:request success:NULL failure:NULL];
operation = [self.client HTTPRequestOperationWithRequest:request success:nil failure:nil];
expect([operation class]).to.equal([AFImageRequestOperation class]);
}
@ -129,7 +129,7 @@
secondCallbackTime = [NSDate date];
}];
[self.client enqueueBatchOfHTTPRequestOperations:@[ firstOperation, secondOperation ] progressBlock:NULL completionBlock:^(NSArray *operations) {
[self.client enqueueBatchOfHTTPRequestOperations:@[ firstOperation, secondOperation ] progressBlock:nil completionBlock:^(NSArray *operations) {
batchCallbackTime = [NSDate date];
}];
@ -145,7 +145,7 @@
[Expecta setAsynchronousTestTimeout:5.0];
__block NSHTTPURLResponse *response = nil;
[self.client getPath:@"/basic-auth/username/password" parameters:nil success:NULL failure:^(AFHTTPRequestOperation *operation, NSError *error) {
[self.client getPath:@"/basic-auth/username/password" parameters:nil success:nil failure:^(AFHTTPRequestOperation *operation, NSError *error) {
response = operation.response;
}];
@ -159,7 +159,7 @@
[self.client setAuthorizationHeaderWithUsername:@"username" password:@"password"];
[self.client getPath:@"/basic-auth/username/password" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
response = operation.response;
} failure:NULL];
} failure:nil];
expect(response.statusCode).will.equal(200);
}
@ -204,7 +204,7 @@
NSMutableURLRequest *secondRequest = [self.client requestWithMethod:@"GET" path:@"/path" parameters:nil];
NSMutableURLRequest *thirdRequest = [self.client requestWithMethod:@"POST" path:@"/path" parameters:nil];
[self.client enqueueBatchOfHTTPRequestOperationsWithRequests:@[ firstRequest, secondRequest, thirdRequest ] progressBlock:NULL completionBlock:NULL];
[self.client enqueueBatchOfHTTPRequestOperationsWithRequests:@[ firstRequest, secondRequest, thirdRequest ] progressBlock:nil completionBlock:nil];
[self.client.operationQueue setSuspended:YES];
[self.client cancelAllHTTPOperationsWithMethod:@"GET" path:@"/path"];
@ -255,7 +255,7 @@
NSError *error = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:blockResponseObject options:0 error:&error];
expect(responseDictionary[@"form"]).to.equal(@{ @"key": @"value" });
expect([responseDictionary valueForKey:@"form"]).to.equal(@{ @"key": @"value" });
}
- (void)testThatEnqueueBatchOfHTTPRequestOperationsConstructsOperationsWithAppropriateRegisteredHTTPRequestOperationClasses {
@ -270,26 +270,26 @@
__block NSArray *operations = nil;
id mockClient = [OCMockObject partialMockForObject:self.client];
void (^theBlock)(NSInvocation *) = ^(NSInvocation *invocation) {
void (^block)(NSInvocation *) = ^(NSInvocation *invocation) {
__unsafe_unretained id argument = nil;
[invocation getArgument:&argument atIndex:2];
operations = argument;
};
[[[mockClient stub] andDo:theBlock] enqueueBatchOfHTTPRequestOperations:[OCMArg any] progressBlock:nil completionBlock:nil];
[[[mockClient stub] andDo:block] enqueueBatchOfHTTPRequestOperations:[OCMArg any] progressBlock:nil completionBlock:nil];
[mockClient enqueueBatchOfHTTPRequestOperationsWithRequests:@[ firstRequest, secondRequest ] progressBlock:nil completionBlock:nil];
expect(operations).notTo.beNil();
expect(operations).to.haveCountOf(2);
expect([operations[0] class]).to.equal([AFJSONRequestOperation class]);
expect([operations[1] class]).to.equal([AFImageRequestOperation class]);
expect([[operations objectAtIndex:0] class]).to.equal([AFJSONRequestOperation class]);
expect([[operations objectAtIndex:1] class]).to.equal([AFImageRequestOperation class]);
}
- (void)testThatEnqueueBatchOfHTTPRequestOperationsEnqueuesOperationsInTheCorrectOrder {
NSMutableURLRequest *request = [self.client requestWithMethod:@"GET" path:@"/" parameters:nil];
AFHTTPRequestOperation *firstOperation = [self.client HTTPRequestOperationWithRequest:request success:NULL failure:NULL];
AFHTTPRequestOperation *secondOperation = [self.client HTTPRequestOperationWithRequest:request success:NULL failure:NULL];
AFHTTPRequestOperation *firstOperation = [self.client HTTPRequestOperationWithRequest:request success:nil failure:nil];
AFHTTPRequestOperation *secondOperation = [self.client HTTPRequestOperationWithRequest:request success:nil failure:nil];
id mockClient = [OCMockObject partialMockForObject:self.client];
id mockOperationQueue = [OCMockObject mockForClass:[NSOperationQueue class]];
@ -310,12 +310,12 @@
batchedOperation = argument;
}] addOperation:OCMOCK_ANY];
[mockClient enqueueBatchOfHTTPRequestOperations:@[ firstOperation, secondOperation ] progressBlock:NULL completionBlock:NULL];
[mockClient enqueueBatchOfHTTPRequestOperations:@[ firstOperation, secondOperation ] progressBlock:nil completionBlock:nil];
expect(operations).to.haveCountOf(2);
expect(operations[0]).to.equal(firstOperation);
expect(operations[1]).to.equal(secondOperation);
expect([operations objectAtIndex:0]).to.equal(firstOperation);
expect([operations objectAtIndex:1]).to.equal(secondOperation);
expect(batchedOperation).notTo.beNil();
expect(batchedOperation).to.beKindOf([NSBlockOperation class]);