diff --git a/Code/ObjectMapping/RKMapperOperation.m b/Code/ObjectMapping/RKMapperOperation.m index 2cd53b8a..a5fcf9ec 100644 --- a/Code/ObjectMapping/RKMapperOperation.m +++ b/Code/ObjectMapping/RKMapperOperation.m @@ -41,9 +41,9 @@ static NSString *RKDelegateKeyPathFromKeyPath(NSString *keyPath) static NSString *RKFailureReasonErrorStringForMappingNotFoundError(id representation, NSDictionary *mappingsDictionary) { NSMutableString *failureReason = [NSMutableString string]; - [failureReason appendFormat:@"The mapping operation was unable to find any nested object representations at the key paths searched: %@", [[mappingsDictionary allKeys] componentsJoinedByString:@", "]]; + [failureReason appendFormat:@"The mapping operation was unable to find any nested object representations at the key paths searched: %@", [[[mappingsDictionary allKeys] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)] componentsJoinedByString:@", "]]; if ([representation respondsToSelector:@selector(allKeys)]) { - [failureReason appendFormat:@"\nThe representation inputted to the mapper was found to contain nested object representations at the following key paths: %@", [[representation allKeys] componentsJoinedByString:@", "]]; + [failureReason appendFormat:@"\nThe representation inputted to the mapper was found to contain nested object representations at the following key paths: %@", [[[representation allKeys] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)] componentsJoinedByString:@", "]]; } [failureReason appendFormat:@"\nThis likely indicates that you have misconfigured the key paths for your mappings."]; return failureReason; diff --git a/Tests/Logic/CoreData/RKManagedObjectStoreTest.m b/Tests/Logic/CoreData/RKManagedObjectStoreTest.m index 70c93786..832b76cf 100644 --- a/Tests/Logic/CoreData/RKManagedObjectStoreTest.m +++ b/Tests/Logic/CoreData/RKManagedObjectStoreTest.m @@ -278,7 +278,7 @@ static NSManagedObjectModel *RKManagedObjectModelWithNameAtVersion(NSString *mod expect(success).to.beTruthy(); expect(resourceValue).to.equal(@(YES)); } -#endif + - (void)testResetPersistentStoresDoesNotTriggerDeadlock { @@ -299,6 +299,7 @@ static NSManagedObjectModel *RKManagedObjectModelWithNameAtVersion(NSString *mod [managedObject2 setValue:@"Blake" forKey:@"name"]; }]; } +#endif - (void)testCleanupOfExternalStorageDirectoryOnReset { @@ -344,6 +345,13 @@ static NSManagedObjectModel *RKManagedObjectModelWithNameAtVersion(NSString *mod NSURL *modelURL = [[RKTestFixture fixtureBundle] URLForResource:@"Data Model" withExtension:@"mom"]; NSManagedObjectModel *model = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL]; RKManagedObjectStore *managedObjectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:model]; + NSEntityDescription *humanEntity = [managedObjectStore.managedObjectModel entitiesByName][@"Human"]; + NSAttributeDescription *photoAttribute = [[NSAttributeDescription alloc] init]; + [photoAttribute setName:@"photo"]; + [photoAttribute setAttributeType:NSTransformableAttributeType]; + [photoAttribute setAllowsExternalBinaryDataStorage:YES]; + NSArray *newProperties = [[humanEntity properties] arrayByAddingObject:photoAttribute]; + [humanEntity setProperties:newProperties]; NSError *error = nil; NSString *storePath = [RKApplicationDataDirectory() stringByAppendingPathComponent:@"This is the Store.sqlite"]; NSPersistentStore *persistentStore = [managedObjectStore addSQLitePersistentStoreAtPath:storePath fromSeedDatabaseAtPath:nil withConfiguration:nil options:nil error:&error]; diff --git a/Tests/Logic/Network/RKManagedObjectRequestOperationTest.m b/Tests/Logic/Network/RKManagedObjectRequestOperationTest.m index f66961bf..a8596050 100644 --- a/Tests/Logic/Network/RKManagedObjectRequestOperationTest.m +++ b/Tests/Logic/Network/RKManagedObjectRequestOperationTest.m @@ -199,7 +199,11 @@ NSSet *RKSetByRemovingSubkeypathsFromSet(NSSet *setOfKeyPaths); [managedObjectRequestOperation waitUntilFinished]; expect(managedObjectRequestOperation.error).notTo.beNil(); expect(managedObjectRequestOperation.mappingResult).to.beNil(); + #if __IPHONE_OS_VERSION_MIN_REQUIRED expect([managedObjectRequestOperation.error localizedDescription]).to.equal(@"The operation couldn’t be completed. (Cocoa error 1660.)"); + #else + expect([managedObjectRequestOperation.error localizedDescription]).to.equal(@"name is too long."); + #endif } #pragma mark - Deletion Response Tests diff --git a/Tests/Logic/ObjectMapping/RKObjectMappingNextGenTest.m b/Tests/Logic/ObjectMapping/RKObjectMappingNextGenTest.m index 8d3a11b1..637fa4b3 100644 --- a/Tests/Logic/ObjectMapping/RKObjectMappingNextGenTest.m +++ b/Tests/Logic/ObjectMapping/RKObjectMappingNextGenTest.m @@ -597,7 +597,7 @@ RKMapperOperation *mapper = [[RKMapperOperation alloc] initWithRepresentation:userInfo mappingsDictionary:mappingsDictionary]; [mapper start]; assertThat([mapper.error localizedDescription], is(equalTo(@"No mappable object representations were found at the key paths searched."))); - assertThat([mapper.error localizedFailureReason], is(equalTo(@"The mapping operation was unable to find any nested object representations at the key paths searched: this, that\nThis likely indicates that you have misconfigured the key paths for your mappings."))); + assertThat([mapper.error localizedFailureReason], is(equalTo(@"The mapping operation was unable to find any nested object representations at the key paths searched: that, this\nThis likely indicates that you have misconfigured the key paths for your mappings."))); } - (void)testThatAnErrorIsSetWithAHelpfulDescriptionWhenNoKeyPathsMatchTheObjectRepresentationBeingMapped @@ -609,7 +609,7 @@ RKMapperOperation *mapper = [[RKMapperOperation alloc] initWithRepresentation:userInfo mappingsDictionary:mappingsDictionary]; [mapper start]; assertThat([mapper.error localizedDescription], is(equalTo(@"No mappable object representations were found at the key paths searched."))); - assertThat([mapper.error localizedFailureReason], is(equalTo(@"The mapping operation was unable to find any nested object representations at the key paths searched: this, that\nThe representation inputted to the mapper was found to contain nested object representations at the following key paths: user\nThis likely indicates that you have misconfigured the key paths for your mappings."))); + assertThat([mapper.error localizedFailureReason], is(equalTo(@"The mapping operation was unable to find any nested object representations at the key paths searched: that, this\nThe representation inputted to the mapper was found to contain nested object representations at the following key paths: user\nThis likely indicates that you have misconfigured the key paths for your mappings."))); } #pragma mark RKMapperOperationDelegate Tests diff --git a/Tests/Logic/ObjectMapping/RKObjectParameterizationTest.m b/Tests/Logic/ObjectMapping/RKObjectParameterizationTest.m index 26711080..118b5d25 100644 --- a/Tests/Logic/ObjectMapping/RKObjectParameterizationTest.m +++ b/Tests/Logic/ObjectMapping/RKObjectParameterizationTest.m @@ -162,11 +162,7 @@ NSString *string = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; expect(error).to.beNil(); - #if TARGET_OS_IPHONE expect(string).to.equal(@"key1-form-name=value1&key2-form-name=value2&relationship1-form-name[r1k1][]=relationship1Value1&relationship1-form-name[r1k1][]=relationship1Value2&relationship2-form-name[subKey1]=subValue1"); - #else - expect(string).to.equal(@"relationship1-form-name[r1k1][]=relationship1Value1&relationship1-form-name[r1k1][]=relationship1Value2&key2-form-name=value2&key1-form-name=value1&relationship2-form-name[subKey1]=subValue1"); - #endif } - (void)testShouldSerializeToJSON @@ -405,7 +401,9 @@ NSString *string = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; expect(error).to.beNil(); - expect(string).to.equal(@"{\"is_valid\":0,\"name\":\"Whatever\",\"is_boolean\":true}"); + // Unordered dictionary handling + NSArray *serializations = @[ @"{\"is_valid\":0,\"name\":\"Whatever\",\"is_boolean\":true}", @"{\"name\":\"Whatever\",\"is_valid\":0,\"is_boolean\":true}" ]; + expect(serializations).to.contain(string); } - (void)testParameterizationofBooleanPropertiesFromManagedObjectProperty