Skip to content
Browse files

Add response descriptors to response operations of failing tests

  • Loading branch information...
1 parent 38f1086 commit 6c470aab304cf68f9e0e21aa753f9dc2a8a332a7 @segiddins segiddins committed Jan 5, 2014
Showing with 12 additions and 2 deletions.
  1. +12 −2 Tests/Logic/Network/RKManagedObjectRequestOperationTest.m
View
14 Tests/Logic/Network/RKManagedObjectRequestOperationTest.m
@@ -394,10 +394,15 @@ - (void)testDeletionOfObjectWithEmptyDictionaryResponseTriggersObjectDeletion
- (void)testDeletionOfObjectWithUnmappedResponseBody
{
RKManagedObjectStore *managedObjectStore = [RKTestFactory managedObjectStore];
+
+ RKEntityMapping *humanMapping = [RKEntityMapping mappingForEntityForName:@"Human" inManagedObjectStore:managedObjectStore];
+ [humanMapping addPropertyMapping:[RKAttributeMapping attributeMappingFromKeyPath:@"name" toKeyPath:@"name"]];
+ RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:humanMapping method:RKRequestMethodAny pathPattern:nil keyPath:@"human" statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
+
RKHuman *human = [RKTestFactory insertManagedObjectForEntityForName:@"Human" inManagedObjectContext:managedObjectStore.persistentStoreManagedObjectContext withProperties:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"/humans/success" relativeToURL:[RKTestFactory baseURL]]];
request.HTTPMethod = @"DELETE";
- RKManagedObjectRequestOperation *managedObjectRequestOperation = [[RKManagedObjectRequestOperation alloc] initWithRequest:request responseDescriptors:@[]];
+ RKManagedObjectRequestOperation *managedObjectRequestOperation = [[RKManagedObjectRequestOperation alloc] initWithRequest:request responseDescriptors:@[ responseDescriptor ]];
managedObjectRequestOperation.managedObjectContext = managedObjectStore.persistentStoreManagedObjectContext;
managedObjectRequestOperation.targetObject = human;
[managedObjectRequestOperation start];
@@ -447,11 +452,16 @@ - (void)testDeletionOfObjectWithResponseDescriptorMappingResponseByKeyPath
- (void)testThatDeletionOfObjectThatHasAlreadyBeenDeletedFromCoreDataDoesNotRaiseException
{
RKManagedObjectStore *managedObjectStore = [RKTestFactory managedObjectStore];
+
+ RKEntityMapping *humanMapping = [RKEntityMapping mappingForEntityForName:@"Human" inManagedObjectStore:managedObjectStore];
+ [humanMapping addPropertyMapping:[RKAttributeMapping attributeMappingFromKeyPath:@"name" toKeyPath:@"name"]];
+ RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:humanMapping method:RKRequestMethodAny pathPattern:nil keyPath:@"human" statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
+
RKHuman *human = [RKTestFactory insertManagedObjectForEntityForName:@"Human" inManagedObjectContext:managedObjectStore.persistentStoreManagedObjectContext withProperties:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"/humans/success" relativeToURL:[RKTestFactory baseURL]]];
request.HTTPMethod = @"DELETE";
[managedObjectStore.persistentStoreManagedObjectContext saveToPersistentStore:nil];
- RKManagedObjectRequestOperation *managedObjectRequestOperation = [[RKManagedObjectRequestOperation alloc] initWithRequest:request responseDescriptors:@[]];
+ RKManagedObjectRequestOperation *managedObjectRequestOperation = [[RKManagedObjectRequestOperation alloc] initWithRequest:request responseDescriptors:@[ responseDescriptor ]];
managedObjectRequestOperation.managedObjectContext = managedObjectStore.persistentStoreManagedObjectContext;
managedObjectRequestOperation.targetObject = human;
[managedObjectRequestOperation start];

0 comments on commit 6c470aa

Please sign in to comment.
Something went wrong with that request. Please try again.