Add coverage for sending synchronous requests with both object loader flavors

This commit is contained in:
Jeff Arena
2012-01-20 11:32:12 -05:00
parent dbb12b37a8
commit c7777ffc8d
2 changed files with 30 additions and 0 deletions

View File

@@ -245,5 +245,21 @@
assertThatBool([doNotDeleteMe isDeleted], is(equalToBool(NO)));
}
- (void)testShouldNotAssertDuringObjectMappingOnSynchronousRequest {
RKManagedObjectStore* store = RKSpecNewManagedObjectStore();
RKObjectManager* objectManager = RKSpecNewObjectManager();
RKSpecStubNetworkAvailability(YES);
objectManager.objectStore = store;
RKObjectMapping* mapping = [RKManagedObjectMapping mappingForClass:[RKHuman class]];
RKManagedObjectLoader* objectLoader = [objectManager loaderWithResourcePath:@"/humans/1"];
objectLoader.objectMapping = mapping;
RKResponse *response = [objectLoader sendSynchronously];
NSArray* humans = [RKHuman findAll];
assertThatUnsignedInteger([humans count], is(equalToInt(1)));
assertThatInteger(response.statusCode, is(equalToInt(200)));
}
@end

View File

@@ -731,4 +731,18 @@
assertThat(blockError, is(equalTo(expectedError)));
}
- (void)testShouldNotAssertDuringObjectMappingOnSynchronousRequest {
RKObjectManager* objectManager = RKSpecNewObjectManager();
RKObjectMapping* userMapping = [RKObjectMapping mappingForClass:[RKSpecComplexUser class]];
userMapping.rootKeyPath = @"data.STUser";
[userMapping mapAttributes:@"firstname", nil];
RKObjectLoader* objectLoader = [objectManager loaderWithResourcePath:@"/humans/1"];
objectLoader.objectMapping = userMapping;
[objectLoader sendSynchronously];
RKResponse *response = [objectLoader sendSynchronously];
assertThatInteger(response.statusCode, is(equalToInt(200)));
}
@end