allending/Kiwi — pull request #125 by dewind (2012-04-25 19:18:12+00:00)
Title: Capture arguments passed to mocks

The following pull request provides an easy-to-use interface for capturing arguments passed to a mock object. It is especially useful for capturing blocks and executing them after the fact. I made sure to properly copy or retain the argument based on whether it was a block or not.

You can reference KWCaptureTest.m to see how it works.

An example:

```objective-c
id robotMock = [KWMock nullMockForClass:[Robot class]];
KWCaptureSpy *spy = [robotMock captureArgument:@selector(speak:afterDelay:whenDone:) atIndex:2];

__block BOOL didCall = NO;
[robotMock speak:@"Hello" afterDelay:2 whenDone:^{
didCall = YES;
}];

void (^block)(void) = spy.argument;
block();
```