I am using Kiwi framework to test the interaction between my code and Core Data through Magical Record library. Magical record defines a category on NSManagedObject, which adds few nice methods, such as MR_createInContext:(NSManagedObjectContext *)context. I am trying to test wether or not, that method is called, and how many times.
it(@"should create new object for me object with new id", ^{
[[[NSManagedObjectContext MR_contextForCurrentThread] should] receive:@selector(MR_createInContext:)];
Me *me = [Me meWithID:@"12345" inContext:[NSManagedObjectContext MR_contextForCurrentThread]];
[me shouldNotBeNil];
[[me.idNumber should] equal:@"12345"];
});
The issue is that Kiwi does not seem to see that category despite
#import <CoreData+MagicalRecord.h>
in the test .m file.
ME_ShouldCreateNewObjectForMeObjectWithNewId (EHMeSpecs) failed: 'ME, should create new object for me object with new id' [FAILED], cannot stub -MR_createInContext: because no such method exist
How can I make Kiwi aware of the category?