flatiron/vows — pull request #307 by moteutsch (2014-07-02 11:59:56+00:00)
Title: Add `this.callback` alternative w/o error argument

Added a function `this.callbackWithoutError` in addition to `this.callback`. This will be used on a case-by-case basis when `topic` is asynchronous and result callback doesn't pass error as first parameter, instead passing the result (to be passed to a vow).

var getFirstWord = function (str, callback) {
callback(str.split(' ')[0]);
};
vows.describe('Example use-case').addBatch({
'Calling getFirstWord with "hello world!"': {
topic: function (router) {
return router.route('hello world', this.callbackWithoutError);
},
'should result in "world"': function (result) {
assert.equal('world', result);
}
}
}).export(module);