         passwordConfirm : 'anotherPassword'
 
     request.post joinTeamRequestParams, (err, res, body) ->
-      expect(err)             .to.not.exist
-      expect(res.statusCode)  .to.be.equal 400
-      expect(body)            .to.be.equal 'Passwords must match!'
+      expect(err).to.not.exist
+      expect(res.statusCode).to.be.equal 400
+      expect(body).to.be.equal 'Passwords must match!'
       done()
 
 
+beforeTests()
+
 runTests()


    # expecting HTTP 400 sending wrong alreadyMember value
    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'
      done()


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

    joinTeamRequestParams = generateJoinTeamRequestParams
      body         :
        username   : ''

    expectedBody = 'Errors were encountered during validation: username'
    request.post joinTeamRequestParams, (err, res, body) ->
      expect(err)             .to.not.exist
      expect(res.statusCode)  .to.be.equal 400
      expect(body)            .to.be.equal expectedBody
      done()



            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            :
