Permalink
Browse files

Added `req.route` test

  • Loading branch information...
tj committed Nov 25, 2011
1 parent 15e7218 commit c3d96df0f013e7a2f72756127acee254e7a459ae
Showing with 27 additions and 0 deletions.
  1. +27 −0 test/req.route.js
View
@@ -0,0 +1,27 @@
+
+var express = require('../')
+ , request = require('./support/http');
+
+describe('req', function(){
+ describe('.route', function(){
+ it('should be the executed Route', function(done){
+ var app = express();
+
+ app.get('/user/:id/:op?', function(req, res, next){
+ req.route.method.should.equal('get');
+ req.route.path.should.equal('/user/:id/:op?');
+ next();
+ });
+
+ app.get('/user/:id/edit', function(req, res){
+ req.route.method.should.equal('get');
+ req.route.path.should.equal('/user/:id/edit');
+ res.end();
+ });
+
+ request(app)
+ .get('/user/12/edit')
+ .expect(200, done);
+ })
+ })
+})

0 comments on commit c3d96df

Please sign in to comment.