 		expect(body).to.match new RegExp("<title>Project Invite - .*</title>")
 		callback()
 
-expectInvalidInvitePage = (user, link, callback=()->) ->
+expectInvalidInvitePage = (user, link, callback=(err,result)->) ->
 	# view invalid invite
 	tryFollowInviteLink user, link, (err, response, body) ->
 		expect(err).to.be.oneOf [null, undefined]

		expect(response.headers.location).to.equal "/project/#{invite.projectId}"
		callback()

expectAcceptInviteAndRedirect = (user, invite, callback=()->) ->
	# should accept the invite and redirect to project
	tryAcceptInvite user, invite, (err, response, body) =>
		expect(err).to.be.oneOf [null, undefined]

					Async.series [
						(cb) => expectInviteRedirectToRegister(@user, @link, cb)
					], done

				it 'should allow user to accept the invite if the user registers a new account', (done) ->
					Async.series [
						(cb) =>
							expectInviteRedirectToRegister @user, @link, (err, redirectUrl) =>
								@_redir = redirectUrl
								cb()
						(cb) =>
							expectRegistrationRedirectToInvite @user, "some_email@example.com", @_redir, @link, cb
						(cb) =>
							expectInvitePage @user, @link, cb
						(cb) =>
							expectAcceptInviteAndRedirect @user, @invite, cb
					], done
