Permalink
Browse files

multi-env configure() callbacks

  • Loading branch information...
1 parent 8ad17ab commit e303dcc915859bb7b8b19dc8c7ea55c5d771ff3a @tj tj committed Nov 9, 2011
Showing with 28 additions and 1 deletion.
  1. +28 −1 test/config.env.js
View
@@ -39,7 +39,34 @@ describe('config', function(){
calls.push('test');
});
- calls.push('dev');
+ calls.should.eql(['dev']);
+ })
+ })
+
+ describe('when several envs are given', function(){
+ it('should execute when matching one', function(){
+ var app = express();
+ var calls = [];
+
+ app.set('env', 'development');
+
+ app.configure('development', function(){
+ calls.push('dev');
+ });
+
+ app.configure('test', 'development', function(){
+ calls.push('dev 2');
+ });
+
+ app.configure('development', 'test', function(){
+ calls.push('dev 3');
+ });
+
+ app.configure('test', function(){
+ calls.push('dev 3');
+ });
+
+ calls.should.eql(['dev', 'dev 2', 'dev 3']);
})
})

0 comments on commit e303dcc

Please sign in to comment.