ios - Mocking expectations and Grand Central Dispatch -


i have simple manager object, , using mocks in kiwi, want check when call [apoimanager fetchnear:location] calls downloadpoisnear:completionblock: on downloader.

everything worked fine until decided dispatch call downloader inside grand central dispatch.

the call being asynchronous, test fails. kiwi has feature check asynchronously value, not check asynchronous calls .

here part of test :

it(@"should call proximity downloader", ^{        cllocation *location = [[cllocation alloc] initwithlatitude:1.0f longitude:1.0f];        id<rmproximitydownloader> mockdownloader =       [kwmock mockforprotocol:@protocol(rmproximitydownloader)];        [[(nsobject*)mockdownloader should] receive:@selector(downloadpoisnear:completionblock:)];        rmpoimanager *apoimanager = [[rmpoimanager alloc] initwithdownloader:mockdownloader];        [apoimanager fetchnear:location];     }); 

try this:

[[(nsobject*)mockdownloader shouldeventually] receive:@selector(downloadpoisnear:completionblock:)]; 

you can use shouldeventuallybeforetimingoutafter(seconds) if needed.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -