 			beforeEach (done) ->
 				@invite = null
 				@link = null
-				createInvite @projectId, @sendingUser, @email, (err, invite) =>
+				createInvite @sendingUser, @projectId, @email, (err, invite) =>
 					@invite = invite
 					@link = CollaboratorsEmailHandler._buildInviteUrl(@fakeProject, @invite)
+					done()
+
+			afterEach (done) ->
+				revokeInvite @sendingUser, @projectId, @invite._id, (err) =>
+					throw err if err
 					done()
 
 			it 'should not grant access if the user does not accept the invite', (done) ->

				privileges: 'readAndWrite'
		}, (err, response, body) ->
			return callback(err) if err
			callback(err, body.invite)


# Actions
tryFollowInviteLink = (user, link, callback=(err, response, body)->) ->

CollaboratorsEmailHandler = require "../../../app/js/Features/Collaborators/CollaboratorsEmailHandler"


createInvite = (sendingUser, projectId, email, callback=(err, invite)->) ->
	sendingUser.getCsrfToken (err) ->
		return callback(err) if err
		sendingUser.request.post {
