Prevent quest leaders from leaving party

(cherry picked from commit dc43aa5902)
This commit is contained in:
Blade Barringer
2015-09-08 19:24:26 -05:00
parent f8850755d0
commit 9abe67b0ad
2 changed files with 21 additions and 2 deletions

View File

@@ -197,6 +197,19 @@ describe('Groups Controller', function() {
expect(res.json).to.be.calledWith(403, 'You cannot leave party during an active quest. Please leave the quest first');
});
it('prevents quest leader from leaving a party if they have started a quest', function() {
group.quest = {
active: false,
leader: 'user-id'
};
groupsController.leave(req, res);
expect(group.leave).to.not.be.called;
expect(res.json).to.be.calledOnce;
expect(res.json).to.be.calledWith(403, 'You cannot leave when you have started a quest. Abort the quest first.');
});
it('leaves party if quest is not active', function() {
group.quest = {
active: false,