test error case for inviteToProject

This commit is contained in:
Shane Kilkelly 2016-07-22 11:54:16 +01:00
parent f866bd03bc
commit c9cfcddbe9

View file

@ -79,3 +79,13 @@ describe "CollaboratorsInviteHandler", ->
@CollaboratorsEmailHandler.notifyUserOfProjectInvite.callCount.should.equal 1
@CollaboratorsEmailHandler.notifyUserOfProjectInvite.calledWith(@projectId, @email).should.equal true
done()
describe 'when saving model produces an error', ->
beforeEach ->
@ProjectInvite::save = sinon.spy (cb) -> cb(new Error('woops'), this)
it 'should produce an error', (done) ->
@call (err, invite) =>
expect(err).to.be.instanceof Error
done()