Q-ify save functions

This commit is contained in:
Blade Barringer
2015-08-24 17:36:06 -05:00
parent f584b173c8
commit ce7d0039f8
3 changed files with 13 additions and 13 deletions

View File

@@ -11,8 +11,6 @@ describe('Groups Controller', function() {
var res, req, group, user, saveSpy;
beforeEach(function() {
sinon.stub(process, 'nextTick').yields();
group = {
_id: 'group-id',
type: 'party',
@@ -47,6 +45,7 @@ describe('Groups Controller', function() {
RSVPNeeded : false
}
},
save: sinon.stub().yields(),
markModified: sinon.spy()
};
@@ -62,10 +61,6 @@ describe('Groups Controller', function() {
req = { };
});
afterEach(function () {
process.nextTick.restore();
});
context('error conditions', function() {
it('errors if quest is not active', function() {
group.quest.active = false;
@@ -104,13 +99,13 @@ describe('Groups Controller', function() {
});
it('sends 500 if group cannot save', function() {
group.save = sinon.stub().yields('save error');
group.save = sinon.stub().throws({err: 'save error'});
var nextSpy = sinon.spy();
groupsController.questLeave(req, res, nextSpy);
expect(nextSpy).to.be.calledOnce;
expect(nextSpy).to.be.calledWith('save error');
expect(nextSpy).to.be.calledWith({err: 'save error'});
});
});