Unwind nil behavior introduced in previous commit and add test coverage for asObject behaviors.

This commit is contained in:
Blake Watters
2011-07-05 17:22:27 -04:00
parent dddc4c3d0a
commit 82ce444489
2 changed files with 15 additions and 5 deletions

View File

@@ -53,13 +53,12 @@
- (id)asObject {
NSArray* collection = [self asCollection];
NSUInteger count = [collection count];
if (count > 1) {
RKLogWarning(@"Coerced object mapping result containing %d objects into singular result.", [collection count]);
} else if (count == 1) {
return [collection objectAtIndex:0];
if (count == 0) {
return nil;
}
return nil;
if (count > 1) RKLogWarning(@"Coerced object mapping result containing %d objects into singular result.", count);
return [collection objectAtIndex:0];
}
- (NSError*)asError {