             alreadyMember : 'true'
 
         request.post joinTeamRequestParams, (err, res, body) ->
-          expect(err)             .to.not.exist
-          expect(res.statusCode)  .to.be.equal 400
-          expect(body)            .to.be.equal 'Access denied!'
-          queue.next()
-
-      -> done()
-
-    ]
-
-    daisy queue
+          expect(err).to.not.exist
+          expect(res.statusCode).to.be.equal 400
+          expect(body).to.be.equal 'Access denied!'
+          next()
+
+    ]
+
+    async.series queue, done
 
 
   it 'should send HTTP 400 if user email is not in allowedDomains', (done) ->
 
-    slug                    = generateRandomString()
-    domains                 = 'gmail.com, koding.com'
-    domainsArray            = convertToArray domains
-
-    queue = [
-
-      ->
+    slug         = generateRandomString()
+    domains      = 'gmail.com, koding.com'
+    domainsArray = convertToArray domains
+
+    queue = [
+
+      (next) ->
         options = { body : { slug, domains } }
         generateCreateTeamRequestParams options, (createTeamRequestParams) ->
 
           # expecting HTTP 200 status code
           request.post createTeamRequestParams, (err, res, body) ->
-            expect(err)             .to.not.exist
-            expect(res.statusCode)  .to.be.equal 200
-            queue.next()
-
-      ->
-        joinTeamRequestParams = generateJoinTeamRequestParams
-          body       :
-            slug     : slug
-            email    : 'notinallowed@domains.com'
+            expect(err).to.not.exist
+            expect(res.statusCode).to.be.equal 200
+            next()
+
+      (next) ->
+        joinTeamRequestParams = generateJoinTeamRequestParams
+          body    :
+            slug  : slug
+            email : 'notinallowed@domains.com'
 
         expectedBody = 'Your email domain is not in allowed domains for this group'
         request.post joinTeamRequestParams, (err, res, body) ->
-          expect(err)             .to.not.exist
-          expect(res.statusCode)  .to.be.equal 400
-          expect(body)            .to.be.equal expectedBody
-          queue.next()
-
-      -> done()
-
-    ]
-
-    daisy queue
+          expect(err).to.not.exist
+          expect(res.statusCode).to.be.equal 400
+          expect(body).to.be.equal expectedBody
+          next()
+
+    ]
+
+    async.series queue, done
 
 
   it 'should send HTTP 400 if invitee token is invalid', (done) ->
 
-    slug                    = generateRandomString()
-    inviteeEmail            = generateRandomEmail()
+    slug         = generateRandomString()
+    inviteeEmail = generateRandomEmail()
 
     joinTeamRequestParams = generateJoinTeamRequestParams
-      body       :
-        slug     : slug
-        token    : 'someInvalidToken'
-
-    queue = [
-
-      ->
+      body    :
+        slug  : slug
+        token : 'someInvalidToken'
+
+    queue = [
+
+      (next) ->
         options = { body : { slug, companyName : slug, invitees : inviteeEmail } }
         generateCreateTeamRequestParams options, (createTeamRequestParams) ->
 
           # expecting HTTP 200 status code
           request.post createTeamRequestParams, (err, res, body) ->
-            expect(err)             .to.not.exist
-            expect(res.statusCode)  .to.be.equal 200
-            queue.next()
-
-      ->
+            expect(err).to.not.exist
+            expect(res.statusCode).to.be.equal 200
+            next()
+
+      (next) ->
         # expecting HTTP 400 using invalid token
         request.post joinTeamRequestParams, (err, res, body) ->
-          expect(err)             .to.not.exist
-          expect(res.statusCode)  .to.be.equal 400
-          expect(body)            .to.be.equal 'Invalid invitation code!'
-          queue.next()
-
-      -> done()
-
-    ]
-
-    daisy queue
+          expect(err).to.not.exist
+          expect(res.statusCode).to.be.equal 400
+          expect(body).to.be.equal 'Invalid invitation code!'
+          next()
+
+    ]
+
+    async.series queue, done
 
 
   it 'should send HTTP 400 if alreadyMember sent with wrong value', (done) ->

        redirect  : 'www.someurl.com'

    request.post postParams, (err, res, body) ->
      expect(err)             .to.not.exist
      expect(res.statusCode)  .to.be.equal 301
      done()


  # joining an unregistered user to the newly created team
  it 'should be able to join unregistered invitee with valid data', (done) ->

    slug                    = generateRandomString()
    token                   = ''
    groupId                 = ''
    accountId               = ''
    inviteeEmail            = generateRandomEmail()
    inviteeUsername         = generateRandomString()

    queue = [

      ->
        options = { body : { slug, companyName : slug, invitees : inviteeEmail } }
        generateCreateTeamRequestParams options, (createTeamRequestParams) ->

          # expecting HTTP 200 status code
          request.post createTeamRequestParams, (err, res, body) ->
            expect(err)             .to.not.exist
            expect(res.statusCode)  .to.be.equal 200
            queue.next()

      ->
        # expecting invitation to be created
        params = { email : inviteeEmail }

        JInvitation.one params, (err, invitation) ->
          expect(err)                   .to.not.exist
          expect(invitation)            .to.exist
          expect(invitation.code)       .to.exist
          expect(invitation.email)      .to.be.equal inviteeEmail
          expect(invitation.status)     .to.be.equal 'pending'
          expect(invitation.groupName)  .to.be.equal slug

          # saving user invitation token
          token = invitation.code
          queue.next()

      ->
        joinTeamRequestParams = generateJoinTeamRequestParams
          body       :
            slug     : slug

            alreadyMember : 'true'

        request.post joinTeamRequestParams, (err, res, body) ->
          expect(err).to.not.exist
          expect(res.statusCode).to.be.equal 400
          expect(body).to.be.equal 'Unknown user name'
          next()

      (next) ->
        # expecting HTTP 400 with invalid password
        joinTeamRequestParams = generateJoinTeamRequestParams
          body            :
