No 'json spaces' by default

Json rendering can be handled by user tools or overridden in their own
app to behave as desired. Minimizes the use of magic env settings.
This commit is contained in:
Roman Shtylman 2014-01-11 10:42:15 -05:00
parent 8c3f153dd4
commit 8c059469fd
3 changed files with 4 additions and 22 deletions

View File

@ -82,10 +82,6 @@ app.defaultConfiguration = function(){
this.set('views', process.cwd() + '/views');
this.set('jsonp callback name', 'callback');
this.configure('development', function(){
this.set('json spaces', 2);
});
if (this.get('env') === 'production') {
this.enable('view cache');
};

View File

@ -52,7 +52,7 @@ describe('res', function(){
})
})
})
describe('when given an object', function(){
it('should respond with json', function(done){
var app = express();
@ -95,14 +95,7 @@ describe('res', function(){
})
describe('"json spaces" setting', function(){
it('should default to 2 in development', function(){
process.env.NODE_ENV = 'development';
var app = express();
app.get('json spaces').should.equal(2);
process.env.NODE_ENV = 'test';
})
it('should be undefined otherwise', function(){
it('should be undefined by default', function(){
var app = express();
assert(undefined === app.get('json spaces'));
})
@ -125,7 +118,7 @@ describe('res', function(){
})
})
})
describe('.json(status, object)', function(){
it('should respond with json and set the .statusCode', function(done){
var app = express();

View File

@ -181,14 +181,7 @@ describe('res', function(){
})
describe('"json spaces" setting', function(){
it('should default to 2 in development', function(){
process.env.NODE_ENV = 'development';
var app = express();
app.get('json spaces').should.equal(2);
process.env.NODE_ENV = 'test';
})
it('should be undefined otherwise', function(){
it('should be undefined by default', function(){
var app = express();
assert(undefined === app.get('json spaces'));
})