ios - Kiwi + MagicalRecord method does not exist -


i using kiwi framework test interaction between code , core data through magical record library. magical record defines category on nsmanagedobject, adds few nice methods, such mr_createincontext:(nsmanagedobjectcontext *)context. trying test wether or not, method called, , how many times.

it(@"should create new object me object 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 kiwi not seem see category despite

#import <coredata+magicalrecord.h> 

in test .m file.

me_shouldcreatenewobjectformeobjectwithnewid (ehmespecs) failed: 'me, should create new object me object new id' [failed], cannot stub -mr_createincontext: because no such method exist

how can make kiwi aware of category?

looking @ name of test, guessing intent to verify core data works, creates new managed object , has proper objectid. don't see need know kiwi should how intercept category , such. write test so:

it(@"should create new object", ^{      nsmanagedobjectcontext *testcontext = [nsmanagedobjectcontext mr_context];     id myobject = [myentity createwithstuff:@{...} incontext:testcontext];      assertthat(myobject, isnot(nil));     assertthat([myobject someattrbiute], is(equalto(@"some value"))); }); 

don't worry testing if category works because test, it's implicitly testing anyway. if test breaks, you'll know pretty category isn't working.

one of rules of testing "don't test language or framework". when you're testing see if category works, you're violating rule , testing else has tested.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -