Permalink
Browse files

Minor style fixes

  • Loading branch information...
1 parent cf3bb6e commit df03aa9d4b98bc09c0a65d86bfd4e99896e63101 @jspahrsummers jspahrsummers committed Feb 10, 2014
Showing with 10 additions and 9 deletions.
  1. +6 −4 Mantle/MTLJSONAdapter.m
  2. +4 −5 MantleTests/MTLJSONAdapterSpec.m
View
@@ -108,15 +108,17 @@ - (id)initWithJSONDictionary:(NSDictionary *)JSONDictionary modelClass:(Class)mo
id value = JSONDictionary;
NSArray *JSONKeyPathComponents = [JSONKeyPath componentsSeparatedByString:@"."];
- for (NSString *itemJSONKeyPathComponent in JSONKeyPathComponents) {
+ for (NSString *itemJSONKeyPathComponent in JSONKeyPathComponents) {
if (![value isKindOfClass:NSDictionary.class]) {
if (error != NULL) {
NSDictionary *userInfo = @{
- NSLocalizedDescriptionKey: NSLocalizedString(@"Invalid JSON dictionary", @""),
- NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:NSLocalizedString(@"%@ could not be created because an invalid JSON dictionary was provided for keypath: %@", @""), NSStringFromClass(modelClass), JSONKeyPath],
- };
+ NSLocalizedDescriptionKey: NSLocalizedString(@"Invalid JSON dictionary", @""),
+ NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:NSLocalizedString(@"%@ could not be parsed because an invalid JSON dictionary was provided for key path \"%@\"", @""), modelClass, JSONKeyPath],
+ };
+
*error = [NSError errorWithDomain:MTLJSONAdapterErrorDomain code:MTLJSONAdapterErrorInvalidJSONDictionary userInfo:userInfo];
}
+
return nil;
}
@@ -74,12 +74,11 @@
});
it(@"should return nil and error with an invalid key path from JSON",^{
-
NSDictionary *values = @{
- @"username": @"foo",
- @"nested": @"bar",
- @"count": @"0"
- };
+ @"username": @"foo",
+ @"nested": @"bar",
+ @"count": @"0"
+ };
NSError *error = nil;
MTLTestModel *model = [MTLJSONAdapter modelOfClass:MTLTestModel.class fromJSONDictionary:values error:&error];

0 comments on commit df03aa9

Please sign in to comment.