Closed sanmai closed 7 years ago
Also this wouldn't work:
let item = Example(context: inMemoryManagedObjectContext);
Failing with:
failed: caught "NSInvalidArgumentException", "An NSManagedObject of class 'myappTests.Example' must have a valid NSEntityDescription."
After exploring NSManagedObjectModel
I came to realise that internally it uses myapp.Example
no matter from where it is used. So if one uses exact full name for classes inside tests even having imported the app module, everything works:
let item: myapp.Example? = try? object(fromJSONDictionary: updateJSON, inContext: inMemoryManagedObjectContext)
How one is supposed to write tests for objects that use Groot?
For example, where I can create an entity inside an
XCTestCase
just fine:Trying the same thing from
XCTestCase
:Fails with: