cjohansen/Sinon.JS — pull request #45 by mantoni (2011-10-13 21:39:12+00:00)
Title: callArg, callArgWith, yield and yieldTo for spy calls

I sometimes find myself writing something like this:

```javascript
var stub = sinon.stub(object, "methodThatTakesCallback");
```

Test execution then invokes ```methodThatTakesCallback``` and might do something else afterwards. Since the callback would normally get invoked asynchronously, I need to call it myself (instead of using a stub with yields):

```javascript
stub.getCall(0).args[2]("abc", 123); // ouch!
```

I would prefer something more convenient:

```javascript
stub.getCall(0).yield("abc", 123);
```

One question though: would it make sense to even skip the ```getCall(n)``` part and always use the last call by default?

```javascript
stub.yield("abc", 123); // not yet possible
```

Not sure whether this could be confusing :-/