From 2386a69f9db78908ebd8f53c166fb7a25b58ad00 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Mon, 14 Mar 2016 15:02:31 +0000 Subject: [PATCH] Always override database config + exit tests on error refs #6354, #6495 & #6599 - don't allow config.database to be merged, instead, override it always - make sure that route tests call done even when they error --- core/server/config/index.js | 6 ++++++ core/test/functional/routes/admin_spec.js | 1 + core/test/functional/routes/channel_spec.js | 1 + core/test/functional/routes/frontend_spec.js | 1 + 4 files changed, 9 insertions(+) diff --git a/core/server/config/index.js b/core/server/config/index.js index 43cb258301..10b477b117 100644 --- a/core/server/config/index.js +++ b/core/server/config/index.js @@ -104,6 +104,12 @@ ConfigManager.prototype.set = function (config) { // local copy with properties that have been explicitly set. _.merge(this._config, config); + // Special case for the database config, which should be overridden not merged + + if (config && config.database) { + this._config.database = config.database; + } + // Special case for the them.navigation JSON object, which should be overridden not merged if (config && config.theme && config.theme.navigation) { this._config.theme.navigation = config.theme.navigation; diff --git a/core/test/functional/routes/admin_spec.js b/core/test/functional/routes/admin_spec.js index b2ae230590..c040ff236a 100644 --- a/core/test/functional/routes/admin_spec.js +++ b/core/test/functional/routes/admin_spec.js @@ -49,6 +49,7 @@ describe('Admin Routing', function () { }).catch(function (e) { console.log('Ghost Error: ', e); console.log(e.stack); + done(e); }); }); diff --git a/core/test/functional/routes/channel_spec.js b/core/test/functional/routes/channel_spec.js index 351d0b6e28..4d60c6313d 100644 --- a/core/test/functional/routes/channel_spec.js +++ b/core/test/functional/routes/channel_spec.js @@ -36,6 +36,7 @@ describe('Channel Routes', function () { }).catch(function (e) { console.log('Ghost Error: ', e); console.log(e.stack); + done(e); }); }); diff --git a/core/test/functional/routes/frontend_spec.js b/core/test/functional/routes/frontend_spec.js index 720e88a288..221bdefec1 100644 --- a/core/test/functional/routes/frontend_spec.js +++ b/core/test/functional/routes/frontend_spec.js @@ -46,6 +46,7 @@ describe('Frontend Routing', function () { }).catch(function (e) { console.log('Ghost Error: ', e); console.log(e.stack); + done(e); }); });