I'm having trouble understanding what a practical application of using Kiwi's KWCaptureSpy
is. I could do something like this and have it pass:
__block id successJSON;
KWCaptureSpy *successBlockSpy =
[HNKServer captureArgument:@selector(GET:parameters:completion:)
atIndex:2];
[[HNKServer sharedServer] GET:@""
parameters:nil
completion:^(id JSON, NSError *error) {
successJSON = JSON;
}];
HNKServerRequestCallback successBlock = successBlockSpy.argument;
successBlock(@"JSON", nil);
[[successJSON shouldEventually] equal:@"JSON"];
but that doesn't seem to actually be testing anything. The example in Kiwi's documentation doesn't help: https://github.com/kiwi-bdd/Kiwi/wiki/Mocks-and-Stubs#capturing-arguments
Has anyone had a good reason to use KWCaptureSpy
in practice?