arunoda/nodemock — pull request #15 by tristanls (2012-01-26 06:31:33+00:00)
Title: Added a callhook method

This is to enable executing code in testing environment after mock is triggered.

Http response use case:

```javascript
var res = new EventEmitter();
var returnData = function (call) {
call(); // callback fired
res.emit( 'data', ... ); // start feeding the response
//...
res.emit( 'end' );
};
httpMock.mock( 'request' ).takes( {
host : 'host',
port : 80,
path : '/',
method : 'GET'
}, function () {} ).returns( reqMock ).callhook( returnData ).calls( 1, [res] );
```

Trigger assertion asynchronously use case:

```javascript
var res = new EventEmitter();
var verify = function (call) {
httpMock.assert();
done(); // some async framework test finish
};
httpMock.mock( 'request' ).takes( {
host : 'host',
port : 80,
path : '/',
method : 'GET'
}, function () {} ).returns( reqMock ).callhook( verify ).calls( 1, [res] );
```