socketstream/socketstream — pull request #421 by RomanMinkin (2014-01-02 01:20:55+00:00)
Title: Update for issue 408 (part 3)

Hi everyone,

Two files so many changes ;)

Linted, beautified and tested (not sure for 100% coverage, but i was trying to do so):
* `lib/http/index.js`
* `lib/http/router.js`

Improvements:
* Added assertions count reset call `assertionCounter#reset()` on each `assertionCounter#check()` call to avoid using mocha's `#beforeEach()` all the time:

```JavaScript
it('should something', function (done) {
ac.check(done); // this calls ac.reset(), so we do not need to put it under .beforeEach()
});
```

* But if you still want to use `assertionCounter#reset()`, now it has a callback, so it allows to reduce number lines of code:
```JavaScript
beforeEach(function (done) {
// ac.reset(); // was
// done(); // was

ac.reset(done); // now
});
```

* For callbacks testing purpose has been added `test/helpers/utils.js` with method `getfunctionName()`, example:
```JavaScript
var f = function myFunctionName() {
return false;
}

getfunctionName(f); // returns 'myFunctionName'
```

p.s. I did merge all the changes including https://github.com/socketstream/socketstream/pull/419, but needed fresh eyes for review. Just wanted to make PR as soon as possible since project started to grow =) I passed the tests locally, lets see what Travis-CI will say =)