           body   :
             name : validTeamDomain
 
-        queue.push ->
+        queue.push (next) ->
           request.post verifySlugRequestParams, (err, res, body) ->
-            expect(err)             .to.not.exist
-            expect(res.statusCode)  .to.be.equal 200
-            expect(body)            .to.be.equal 'Domain is available!'
-            queue.next()
+            expect(err).to.not.exist
+            expect(res.statusCode).to.be.equal 200
+            expect(body).to.be.equal 'Domain is available!'
+            next()
 
-      queue.push -> done()
-
-      daisy queue
+      async.series queue, done
 
 
   describe 'when domain is taken', ->


      # expecting HTTP 400 when domain is taken
      request.post verifySlugRequestParams, (err, res, body) ->
        expect(err)             .to.not.exist
        expect(res.statusCode)  .to.be.equal 400
        expect(body)            .to.be.equal 'Invalid domain!'
        done()


runTests()

{ async
  expect
  request
  generateRandomString
  checkBongoConnectivity }          = require '../../../testhelper'
{ generateVerifySlugRequestParams } = require '../../../testhelper/handler/verifyslughelper'
{ generateCreateTeamRequestParams } = require '../../../testhelper/handler/teamhelper'

reservedTeamDomains = require '../../../../workers/social/lib/social/models/user/reservedteamdomains'


beforeTests = -> before (done) ->

  checkBongoConnectivity done


runTests = -> describe 'server.handlers.verifyslug', ->

  it 'should send HTTP 404 if request method is not POST', (done) ->

    queue   = []
    methods = ['put', 'patch', 'delete']

    methods.forEach (method) ->
      verifySlugRequestParams = generateVerifySlugRequestParams
        method : method
        body   :
          name : 'some-domain'

      queue.push (next) ->
        request verifySlugRequestParams, (err, res, body) ->
          expect(err).to.not.exist
          expect(res.statusCode).to.be.equal 404
          next()

    async.series queue, done


  describe 'when team domain is not set', ->
