Added res.locals(obj) test

This commit is contained in:
Tj Holowaychuk 2011-11-08 19:53:22 -08:00
parent 2937309f00
commit 2c0e13b513

25
test/res.locals.js Normal file
View File

@ -0,0 +1,25 @@
var express = require('../')
, request = require('./support/http');
describe('res', function(){
describe('.locals(obj)', function(){
it('should merge locals', function(done){
var app = express();
app.use(function(req, res){
Object.keys(res.locals).should.eql([]);
res.locals({ user: 'tobi', age: 1 });
res.locals.user.should.equal('tobi');
res.locals.age.should.equal(1);
res.end();
});
request(app)
.get('/')
.end(function(res){
done();
})
})
})
})