Skip to content

Commit

Permalink
Call mock() to init assertions count for referee 1.1.0 onward.
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffano committed Nov 6, 2014
1 parent 9254010 commit 04e74a6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/cli.js
Expand Up @@ -13,6 +13,7 @@ buster.testCase('cli - exec', {
assert.defined(actions.commands.gen.action);
done();
};
this.mock({});
this.stub(bag, 'command', mockCommand);
cli.exec();
}
Expand Down
3 changes: 3 additions & 0 deletions test/datagen.js
Expand Up @@ -8,6 +8,9 @@ var buster = require('buster-node'),
assert = referee.assert;

buster.testCase('datagen - init', {
setUp: function () {
this.mock({});
},
'should delegate to ncp ncp when initialising the project': function (done) {
this.stub(ncp, 'ncp', function (source, dest, cb) {
assert.isTrue(source.match(/.+\/datagen\/examples$/).length === 1);
Expand Down
28 changes: 27 additions & 1 deletion test/functions.js
Expand Up @@ -5,6 +5,9 @@ var _ = require('lodash'),
assert = referee.assert;

buster.testCase('functions - integer', {
setUp: function () {
this.mock({});
},
'should evaluate integer function when it has no argument': function (done) {
functions.integer(function (data) {
assert.isNumber(data);
Expand Down Expand Up @@ -32,6 +35,9 @@ buster.testCase('functions - integer', {
});

buster.testCase('functions - float', {
setUp: function () {
this.mock({});
},
'should evaluate float function when it has no argument': function (done) {
functions.float(function (data) {
assert.isNumber(data);
Expand Down Expand Up @@ -59,6 +65,9 @@ buster.testCase('functions - float', {
});

buster.testCase('functions - date', {
setUp: function () {
this.mock({});
},
'should evaluate date function with ISO format when it has no argument': function (done) {
functions.date(function (data) {
assert.isTrue(data.match(/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}/).length > 0);
Expand Down Expand Up @@ -90,6 +99,9 @@ buster.testCase('functions - date', {
});

buster.testCase('functions - select', {
setUp: function () {
this.mock({});
},
'should evaluate select function when it has arguments': function (done) {
functions.select('aaa', 'bbb', 'ccc', function (data) {
var pos = ['aaa','bbb','ccc'].indexOf(data);
Expand All @@ -114,6 +126,9 @@ buster.testCase('functions - select', {
});

buster.testCase('functions - word', {
setUp: function () {
this.mock({});
},
'should evaluate a single word when word function has no argument': function (done) {
functions.word(function (data) {
assert.isString(data);
Expand All @@ -135,7 +150,9 @@ buster.testCase('functions - word', {
});

buster.testCase('functions - firstName', {

setUp: function () {
this.mock({});
},
'should evaluate first name function': function (done) {
functions.first_name(function (data) {
assert.isString(data);
Expand All @@ -146,6 +163,9 @@ buster.testCase('functions - firstName', {
});

buster.testCase('functions - lastName', {
setUp: function () {
this.mock({});
},
'should evaluate last name function': function (done) {
functions.last_name(function (data) {
assert.isString(data);
Expand All @@ -156,6 +176,9 @@ buster.testCase('functions - lastName', {
});

buster.testCase('functions - email', {
setUp: function () {
this.mock({});
},
'should evaluate email function': function (done) {
functions.email(function (data) {
assert.isString(data);
Expand All @@ -166,6 +189,9 @@ buster.testCase('functions - email', {
});

buster.testCase('functions - phone', {
setUp: function () {
this.mock({});
},
'should evaluate phone function with default format when format is not specified': function (done) {
functions.phone(function (data) {
assert.isString(data);
Expand Down

0 comments on commit 04e74a6

Please sign in to comment.