Fix all test breakage in OS X Framework tests

This commit is contained in:
Blake Watters
2013-01-15 09:07:44 -05:00
parent f33a8bb405
commit 259e6c2fe5
5 changed files with 20 additions and 10 deletions

View File

@@ -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;

View File

@@ -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];

View File

@@ -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 couldnt be completed. (Cocoa error 1660.)");
#else
expect([managedObjectRequestOperation.error localizedDescription]).to.equal(@"name is too long.");
#endif
}
#pragma mark - Deletion Response Tests

View File

@@ -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

View File

@@ -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