Fixed app.set() with undefined

This commit is contained in:
Tj Holowaychuk 2011-12-15 09:00:39 -08:00
parent b4ce57caec
commit 7d24c2ba40
2 changed files with 6 additions and 1 deletions

View File

@ -332,7 +332,7 @@ app.is = function(type, fn){
*/
app.set = function(setting, val){
if (val === undefined) {
if (1 == arguments.length) {
if (this.settings.hasOwnProperty(setting)) {
return this.settings[setting];
} else if (this.parent) {

View File

@ -8,6 +8,11 @@ describe('config', function(){
var app = express();
app.set('foo', 'bar').should.equal(app);
})
it('should return the app when undefined', function(){
var app = express();
app.set('foo', undefined).should.equal(app);
})
})
describe('.get()', function(){