Test when the user recieves second invite to project

This commit is contained in:
Shane Kilkelly 2016-08-01 10:57:20 +01:00
parent 545ce79c71
commit 5159cdd0e9

View file

@ -10,7 +10,7 @@ createInvite = (sendingUser, projectId, email, callback=(err, invite)->) ->
sendingUser.getCsrfToken (err) ->
return callback(err) if err
sendingUser.request.post {
url: "/project/#{projectId}/invite",
uri: "/project/#{projectId}/invite",
json:
email: email
privileges: 'readAndWrite'
@ -40,7 +40,7 @@ revokeInvite = (sendingUser, projectId, inviteId, callback=(err)->) ->
sendingUser.getCsrfToken (err) ->
return callback(err) if err
sendingUser.request.delete {
url: "/project/#{projectId}/invite/#{inviteId}",
uri: "/project/#{projectId}/invite/#{inviteId}",
}, (err, response, body) ->
return callback(err) if err
callback(null)
@ -181,6 +181,24 @@ describe "ProjectInviteTests", ->
expectInviteRedirectToProject @user, @link, @invite, cb
], done
describe 'when the user recieves another invite to the same project', ->
it 'should redirect to the project page', (done) ->
Async.series [
(cb) =>
createInvite @sendingUser, @projectId, @email, (err, invite) =>
if err
throw err
@secondInvite = invite
@secondLink = CollaboratorsEmailHandler._buildInviteUrl(@fakeProject, invite)
cb()
(cb) =>
expectInviteRedirectToProject @user, @secondLink, @secondInvite, cb
(cb) =>
revokeInvite @sendingUser, @projectId, @secondInvite._id, cb
], done
describe 'user is not a member of the project', ->
it 'should not grant access if the user does not accept the invite', (done) ->