soffes / ssdatakit

Eliminate your Core Data boilerplate code
MIT License
453 stars 57 forks source link

doesn't work with OCTests #18

Closed JanC closed 11 years ago

JanC commented 11 years ago

Hi, my app works fine with SSDataKit but when I try to run some Unit Tests, I get the exception

An NSManagedObject of class 'XXXX' must have a valid NSEntityDescription.

when instantiating a new managed object. My model definition is included in the test target.

any idea what is wrong?

cheers

soffes commented 11 years ago

It sounds like you're using a fetch request without an entity. This isn't a data kit issue.

JanC commented 11 years ago

I just instantiate my SSManagedObject:

TMCard *card = [[TMCard alloc] init];
soffes commented 11 years ago

In your subclass, you need to define entityName and make sure the model file is added to the tests target.

JanC commented 11 years ago

That's what I do

This is my model file:

screen shot 2013-07-29 at 9 13 36 pm

The name ob my class and model entity is TMCard.

I did not override the entityName because the SSManagedObject impl uses the class name as the entity name and they are the same.

I believe the model file is somehow not copied to the test app.

soffes commented 11 years ago

Well sounds like you got it all setup. Sounds like an OCTest issue. I'd strongly recommend switching to SenTest/XCTest by the way.

JanC commented 11 years ago

okey, I'll try that. thanks