I'm running a plain old vanilla iOS logic test bundle (not application tests).
I followed Saul's article on Cocoa is my Girlfriend (http://www.cimgf.com/2012/05/15/unit-testing-with-core-data/) to set up the core data stack in memory. I get through the setup method, and it looks like the core data stack is ready to go.
I can print out a description of my model, and it includes the Person object. But when I try to run [Person createEntity], I get this:
+entityForName: could not locate an entity named 'Person' in this model
it's failing on:
I've got my core data model being compiled as ppart of my unit test bundle, but it can't find the entity.
For completeness, here are my setUp, tearDown, and test methods from my test class:
[MagicalRecord setDefaultModelFromClass:[self class]];
// This is where it fails
Person *firstPerson = [Person createEntity];
Any ideas on where I can begin troubleshooting?
Never mind - I had another test case that was creating the model improperly and not tearing it back down. This was overriding the setUp method in the other test case, since the core data stack already existed at that point.
Closing this issue.
+1 This happened to me too, so thanks for leaving that note!
Ended up having to binary chop through the test cases to find the offending one. Now all is good.