mercredi 6 mai 2015

What is a practical example of using Kiwi's KWCaptureSpy?

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: http://ift.tt/1bycsk2

Has anyone had a good reason to use KWCaptureSpy in practice?

Aucun commentaire:

Enregistrer un commentaire