         email : 'someInvalidEmail'
 
     request.post validateEmailRequestParams, (err, res, body) ->
-      expect(err)             .to.not.exist
-      expect(res.statusCode)  .to.be.equal 400
-      expect(body)            .to.be.equal 'Bad request'
+      expect(err).to.not.exist
+      expect(res.statusCode).to.be.equal 400
+      expect(body).to.be.equal 'Bad request'
       done()
 
 

    username  = generateRandomUsername()

    registerRequestParams = generateRegisterRequestParams
      body     :
        email  : email

    validateEmailRequestParams = generateValidateEmailRequestParams
      body     :
        email  : email

    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()

      ->
        # expecting email validation to fail using already registered email
        request.post validateEmailRequestParams, (err, res, body) ->
          expect(err)             .to.not.exist
          expect(res.statusCode)  .to.be.equal 400
          expect(body)            .to.be.equal 'Bad request'
          queue.next()

      -> done()

    ]

    daisy queue


  it 'should send HTTP 400 if dotted gmail address is in use', (done) ->

    email     = generateRandomEmail 'gmail.com'
    username  = generateRandomUsername()

    registerRequestParams = generateRegisterRequestParams
      body     :
        email  : email

    [username, host] = email.split '@'



    queue = [

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

      (next) ->
        # setting two factor authentication on by adding twofactorkey field
        JUser.update { username }, { $set: { twofactorkey: 'somekey' } }, (err) ->
          expect(err).to.not.exist
          next()

      (next) ->
        # expecting 400 for the 2fa enabled account
        request.post validateEmailRequestParams, (err, res, body) ->
          expect(err).to.not.exist
          expect(res.statusCode).to.be.equal 400
          expect(body).to.be.equal 'TwoFactor auth Enabled'
          next()

    ]

    async.series queue, done


  it 'should send HTTP 200 if email is in use and password is valid', (done) ->
