domenic/sinon-chai — pull request #42 by boneskull (2014-06-10 09:57:25+00:00)
Title: allow assertions against chained stub objects

Since Sinon 1.8, you can chain `.onCall()` methods and give them return values, which is really handy. If you write your code like this:

```js
var stub = sinon.stub();
stub.onCall(0).returns(1);
```

Everything is fine and dandy, but if you did this:

```js
var stub = sinon.stub().onCall(0).returns(1);
```

`stub` is not a function; it's an object with a `stub` proxy function in it.

Given a function under test `A()` which calls stubbed function `B()`, it's often convenient to simply create a reference to the stub of `B()`. You have many options to make assertions here: reference the `stub` property of the object (`sinon.stub().onCall(0).returns(1).stub`); use the first syntax as above, or simply query the original function.

I didn't really like any of these options; I thought it would be nice to allow assertions against these objects directly, like "call" objects. This PR enables that behavior.

- detect and dereference stub objects to get at the actual proxy
- add a check to ensure a stub object is really a stub object
- upgrade `sinon`, since the tests seem to pass
- added tests

I won't be offended if you don't want to merge this; I realize it addresses a very minor issue and the overhead may be disproportionate to the feature you get.