Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a test for loading Env vars in config.

  • Loading branch information...
commit b5e7da307725bffd1f32eb2293454038468bfc86 1 parent 4fe1a2e
@codyhanson codyhanson authored
Showing with 23 additions and 0 deletions.
  1. +16 −0 test/config_test.js
  2. +7 −0 test/database_with_env.json
View
16 test/config_test.js
@@ -39,6 +39,22 @@ vows.describe('config').addBatch({
}
}
}).addBatch({
+ 'loading from a file with ENV vars': {
+ topic: function() {
+ process.env['DB_MIGRATE_TEST_VAR'] = 'username_from_env';
+ var configPath = path.join(__dirname, 'database_with_env.json');
+ config.load = _configLoad;
+ config.loadUrl = _configLoadUrl;
+ config.load(configPath, 'prod');
+ return config;
+ },
+
+ 'should load a value from the environments': function (config) {
+ assert.equal(config.prod.username, 'username_from_env');
+ },
+}
+
+}).addBatch({
'loading from an URL': {
topic: function() {
var databaseUrl = 'postgres://uname:pw@server.com/dbname';
View
7 test/database_with_env.json
@@ -0,0 +1,7 @@
+{
+ "prod": {
+ "driver": "sqlite3",
+ "filename": "prod.db",
+ "username": {"ENV": "DB_MIGRATE_TEST_VAR"}
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.