 					expect(invite).to.have.all.keys ['_id', 'email', 'token', 'sendingUserId', 'projectId', 'privileges']
 					done()
 
+			it 'should have generated a random token', (done) ->
+				@call (err, invite) =>
+					@randomBytesSpy.callCount.should.equal 1
+					done()
+
 			it 'should have called ProjectInvite.save', (done) ->
 				@call (err, invite) =>
 					@ProjectInvite::save.callCount.should.equal 1

			'../Contacts/ContactManager': @ContactManager = {}
			'../../models/Project': {Project: @Project}
			'../../models/ProjectInvite': {ProjectInvite: @ProjectInvite}

		@projectId = ObjectId()
		@sendingUserId = ObjectId()

SandboxedModule = require('sandboxed-module')
events = require "events"
ObjectId = require("mongojs").ObjectId
Crypto = require('crypto')

describe "CollaboratorsInviteHandler", ->
	beforeEach ->
