done handler in final then, to ensure errors in last block are reported

This commit is contained in:
Tim Griesser 2013-05-26 21:39:38 -04:00
parent d98ac4cf4a
commit df23939554
3 changed files with 33 additions and 36 deletions

View File

@ -26,7 +26,7 @@
results.length.should.equal(2);
done();
}, done);
}).then(null, done);
});
it('can read', function (done) {
@ -46,7 +46,7 @@
found.attributes.title.should.equal(firstPost.attributes.title);
done();
}, done);
}).then(null, done);
});
it('can edit', function (done) {
@ -70,7 +70,7 @@
done();
}, done);
}).then(null, done);
});
it('can add', function (done) {
@ -87,7 +87,7 @@
createdPost.attributes.slug.should.equal(newPost.title.toLowerCase().replace(/ /g, '-'), 'slug is correct');
done();
}, done);
}).then(null, done);
});
it('can delete', function (done) {
@ -119,7 +119,7 @@
done();
}, done);
}).then(null, done);
});
});
}());

View File

@ -27,7 +27,7 @@
results.length.should.be.above(0);
done();
}, done);
}).then(null, done);
});
it('can read', function (done) {
@ -51,7 +51,7 @@
done();
}, done);
}).then(null, done);
});
it('can edit single', function (done) {
@ -85,7 +85,7 @@
done();
}, done);
}).then(null, done);
});
it('can edit multiple', function (done) {
@ -128,7 +128,7 @@
done();
}, done);
}).then(null, done);
});
it('can add', function (done) {
@ -145,7 +145,7 @@
createdSetting.attributes.value.should.equal(newSetting.value, "value is correct");
done();
}, done);
}).then(null, done);
});
it('can delete', function (done) {
@ -179,7 +179,7 @@
done();
}, done);
}).then(null, done);
});
});
}());

View File

@ -20,6 +20,7 @@
});
it('can browse', function (done) {
users.browse().then(function (results) {
should.exist(results);
@ -27,9 +28,8 @@
results.length.should.be.above(0);
done();
}, function (error) {
throw error;
});
}).then(null, done);
});
it('can read', function (done) {
@ -43,18 +43,18 @@
firstUser = results.models[0];
users.read({email_address: firstUser.attributes.email_address}).then(function (found) {
return users.read({email_address: firstUser.attributes.email_address});
should.exist(found);
}).then(function (found) {
found.attributes.username.should.equal(firstUser.attributes.username);
should.exist(found);
done();
}, function (error) {
throw error;
});
found.attributes.username.should.equal(firstUser.attributes.username);
done();
}).then(null, done);
});
});
it('can edit', function (done) {
@ -68,19 +68,17 @@
firstUser = results.models[0];
users.edit({id: firstUser.id, url: "some.newurl.com"}).then(function (edited) {
return users.edit({id: firstUser.id, url: "some.newurl.com"});
should.exist(edited);
}).then(function (edited) {
edited.attributes.url.should.equal('some.newurl.com');
should.exist(edited);
done();
}, function (error) {
throw error;
});
}, function (error) {
throw error;
});
edited.attributes.url.should.equal('some.newurl.com');
done();
}).then(null, done);
});
it('can add', function (done) {
@ -97,9 +95,7 @@
createdUser.attributes.email_address.should.eql(userData.email_address, "email address corred");
done();
}, function (error) {
throw error;
});
}).then(null, done);
});
it('can delete', function (done) {
@ -136,7 +132,8 @@
hasDeletedId.should.equal(false);
done();
}, done);
}).then(null, done);
});
});