           ]
 
         Relationship.one params, (err, relationship) ->
-          expect(err)          .to.not.exist
-          expect(relationship) .to.exist
-          queue.next()
-
-      ->
+          expect(err).to.not.exist
+          expect(relationship).to.exist
+          next()
+
+      (next) ->
         # expecting account also to be saved as a member
         params =
           $and : [

    generateCreateTeamRequestParams options, (createTeamRequestParams) ->

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


  it 'should send HTTP 400 when email is in use and username is not in use', (done) ->

    email                   = generateRandomEmail()
    username                = generateRandomString()
    anotherUsername         = generateRandomString()

    registerRequestParams   = generateRegisterRequestParams
      body        :
        email     : email
        username  : username

    queue = [

      ->
        # registering a new user
        request.post registerRequestParams, (err, res, body) ->
          expect(err)             .to.not.exist
          expect(res.statusCode)  .to.be.equal 200
          queue.next()

      ->
        options = { body : { email, username : anotherUsername } }
        generateCreateTeamRequestParams options, (createTeamRequestParams) ->
        #
          # expecting HTTP 400 from juser.convert
          expectedBody = 'Email is already in use!'
          request.post createTeamRequestParams, (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


  it 'should send HTTP 400 when username is not set', (done) ->

    expectedBody            = 'Errors were encountered during validation: username'

    options = { body : { username : '' } }
    generateCreateTeamRequestParams options, (createTeamRequestParams) ->

      request.post createTeamRequestParams, (err, res, body) ->
        expect(err)             .to.not.exist
        expect(res.statusCode)  .to.be.equal 400
        expect(body)            .to.be.equal expectedBody
        done()



          ]

        Relationship.one params, (err, relationship) ->
          expect(err).to.not.exist
          expect(relationship).to.exist
          next()

      (next) ->
        # expecting user to be saved as the owner of the account
        params =
          $and : [
