diff --git a/Mantle/MTLJSONAdapter.h b/Mantle/MTLJSONAdapter.h index 847fb10b..fc62329c 100644 --- a/Mantle/MTLJSONAdapter.h +++ b/Mantle/MTLJSONAdapter.h @@ -98,8 +98,7 @@ extern const NSInteger MTLJSONAdapterErrorInvalidJSONDictionary; // // JSONDictionary - A dictionary representing JSON data. This should match the // format returned by NSJSONSerialization. If this argument is -// nil, the method returns nil and set error to -// MTLJSONAdapterErrorInvalidJSONDictionary. +// nil, the method returns nil and an error with code MTLJSONAdapterErrorInvalidJSONDictionary. // modelClass - The MTLModel subclass to attempt to parse from the JSON. // This class must conform to . This // argument must not be nil. diff --git a/Mantle/MTLJSONAdapter.m b/Mantle/MTLJSONAdapter.m index 5d7748f0..26df55fc 100644 --- a/Mantle/MTLJSONAdapter.m +++ b/Mantle/MTLJSONAdapter.m @@ -79,8 +79,7 @@ - (id)initWithJSONDictionary:(NSDictionary *)JSONDictionary modelClass:(Class)mo NSLocalizedDescriptionKey: NSLocalizedString(@"Invalid JSONDictionary", @""), NSLocalizedFailureReasonErrorKey: NSLocalizedString(@"The JSONDictionary parameter is invalid.", @"") }; - *error = [NSError errorWithDomain:MTLJSONAdapterErrorDomain code:MTLJSONAdapterErrorInvalidJSONDictionary - userInfo:userInfo]; + *error = [NSError errorWithDomain:MTLJSONAdapterErrorDomain code:MTLJSONAdapterErrorInvalidJSONDictionary userInfo:userInfo]; } return nil; } diff --git a/MantleTests/MTLJSONAdapterSpec.m b/MantleTests/MTLJSONAdapterSpec.m index e5a9677e..c4959397 100644 --- a/MantleTests/MTLJSONAdapterSpec.m +++ b/MantleTests/MTLJSONAdapterSpec.m @@ -73,7 +73,7 @@ expect([MTLJSONAdapter JSONDictionaryFromModel:model]).to.equal(values); }); -it(@"should return nil with a nil JSON dictionary, and invalid json error", ^{ +it(@"should return nil and an error with a nil JSON dictionary", ^{ NSError *error = nil; MTLJSONAdapter *adapter = [[MTLJSONAdapter alloc] initWithJSONDictionary:nil modelClass:MTLTestModel.class error:&error]; expect(adapter).to.beNil(); @@ -153,6 +153,3 @@ }); SpecEnd - - -