Created
August 28, 2015 20:02
-
-
Save thiagolioy/01add707aff57a348590 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+(NSDictionary*)parse:(NSDictionary*)dc{ | |
NSMutableDictionary *mutDc = [NSMutableDictionary dictionaryWithDictionary:dc]; | |
for(NSString *key in mutDc.allKeys){ | |
NSString *value = [mutDc objectForKey:key]; | |
if([value isEqualToString:@"true"]) | |
[mutDc setObject:@YES forKey:key]; | |
else if([value isEqualToString:@"false"]) | |
[mutDc setObject:@NO forKey:key]; | |
} | |
return (NSDictionary*)mutDc; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it(@"should parse bool strings", ^{ | |
NSDictionary *dc = @{ | |
@"first":@"true", | |
@"second":@"false", | |
@"third":@"anotherThing" | |
}; | |
NSDictionary *expec = [IPFValidator parse:dc]; | |
expect(expec[@"first"]).to.beTruthy(); | |
expect(expec[@"second"]).to.beFalsy(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment