cloudhead/vows — pull request #222 by phstc (2012-07-02 02:39:41+00:00)
Title: Adding beforeSuite and afterSuite.

Hey!

I'm adding ```beforeSuite``` and ```afterSuite```, these functions can help in cases that a setup is needed to run the batches, i.e. to create a server before the batches and to close it after the batches.

```
var server;
vows.describe('HTTP').addBatch({
'hello world server': {
topic: function(){
request.get('http://localhost:8080', this.callback)
},
'should say hello world': function(err, res, body){
assert.equal(body, 'Hello World');
}
}
}).beforeSuite(function(){
server = require('http').createServer(function(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World');
}).listen(8080, this.done)
}).afterSuite(function(){
server.close();
this.done();
}).export(module);
```

Both ```beforeSuite``` and ```afterSuite``` must call ```this.done()``` after their setup to proceed with the batches execution.