build: update example dependencies
[express.git] / test / app.all.js
blobe9ef08831df6275b20a78bc24270150e8fc5e627
2 var express = require('../')
3   , request = require('supertest');
5 describe('app.all()', function(){
6   it('should add a router per method', function(done){
7     var app = express();
9     app.all('/tobi', function(req, res){
10       res.end(req.method);
11     });
13     request(app)
14     .put('/tobi')
15     .expect('PUT', function(){
16       request(app)
17       .get('/tobi')
18       .expect('GET', done);
19     });
20   })
22   it('should run the callback for a method just once', function(done){
23     var app = express()
24       , n = 0;
26     app.all('/*', function(req, res, next){
27       if (n++) return done(new Error('DELETE called several times'));
28       next();
29     });
31     request(app)
32     .del('/tobi')
33     .expect(404, done);
34   })