Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RKMappingTest throws error when source object key value is null #634

Closed
patr1ck opened this issue Mar 31, 2012 · 1 comment
Closed

RKMappingTest throws error when source object key value is null #634

patr1ck opened this issue Mar 31, 2012 · 1 comment
Milestone

Comments

@patr1ck
Copy link

patr1ck commented Mar 31, 2012

Given an object Name:

{
"name":"foo"
"created_at": 1332880246, 
"updated_at": 1332880246, 
"value":null
}

and a mapping where:

[mapping mapKeyPath:@"value" toAttribute:@"value"];

The following test fails:

id parsedJSON = [RKTestFixture parsedObjectWithContentsOfFixture:@"name.json"];
RKMappingTest *test = [RKMappingTest testForMapping:nameMapping object:parsedJSON];

[test expectMappingFromKeyPath:@"value" toKeyPath:@"value"];
STAssertNoThrow([test verify], nil);

I dug into RestKit a bit and noticed that if the RKObjectMappingOperation skips the mapping if the value is null, so the test never finds the related mapping event.

Is this expected? Does it not make sense to want to test to make sure a null value is still null after mapping?

@blakewatters
Copy link
Member

This is a good point. The null value should generating some kind of mapping event even if it requires an additional delegate callback to handle. Will take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants