beforeEach(function(done) {
        var self = this;

        this.manager = {
          create: this.sinon.stub().callsArgWith(1, null, [
            new domain.User({
              email: '*****@*****.**'
            })
          ])
        };

        var app = express();
        app.use(require('body-parser')());

        this.mailer = {
          sendSignupEmail: sinon.stub().callsArgWith(1, null)
        };

        app.use(handler(this.manager, this.mailer).create);

        request(app)
        .post('/')
        .send({
          email: '*****@*****.**',
          password: '******'
        }).
        end(function(err, res) {
          self.res = res;
          done(err);
        });
      });
      beforeEach(function(done) {
        var self = this;
        this.manager = {
          updateSettings: this.sinon.stub().callsArgWith(2, null, [
            new domain.User({
              email: '*****@*****.**',
              settings: [ { categories: [ 'myCategory' ] } ]
            })
          ])
        };

        var app = express();
        app.use(require('body-parser')());
        app.use(handler(this.manager).updateSettings);

        request(app)
        .put('/')
        .send({
          email: '*****@*****.**',
          password: '******',
          settings: [ { categories: [ 'myNewCategory' ] } ]
        }).
        end(function(err, res) {
          self.res = res;
          done(err);
        });
      });
 it('should return a 500', function(done) {
   this.app.use(handler(this.manager).updateSettings);
   this.app.use(this.errorHandler);
   request(this.app)
   .put('/')
   .expect(500)
   .end(function(err, res) {
     done(err);
   });
 });