-{ daisy
+{ async
   expect
   request
   generateRandomEmail


    queue = [

      ->
        # generating a new certificate and saving it
        certificate1 = new JPasswordRecovery
          email        : email


        certificate.save (err) ->
          expect(err).to.not.exist
          next()

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

      (next) ->
        # keeping user's password to compare after reset request
        JUser.one { username }, (err, user) ->
          expect(err).to.not.exist
          passwordBeforeReset = user.password
          next()

      (next) ->
        # expecting reset request to succeed
        request.post resetRequestParams, (err, res, body) ->
          expect(err).to.not.exist
          expect(res.statusCode).to.be.equal 200
          next()

      (next) ->
        # expecting user's password not to be changed after reset request
        JUser.one { username }, (err, user) ->
          expect(err).to.not.exist
          expect(user.password).to.not.be.equal passwordBeforeReset
          next()

    ]

    async.series queue, done


  it 'should send HTTP 200 and invalidate other tokens after resetting', (done) ->
