From 1cc15a71d68f79f47810d3f753a889ecc333c1af Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 8 Apr 2014 16:52:50 -0400 Subject: [PATCH] resolved #1350 --- app.js | 11 +++++------ mocks/databasemock.js | 10 +++++++++- tests/groups.js | 1 - 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/app.js b/app.js index dc16dc6a63..6a1bb9d49d 100644 --- a/app.js +++ b/app.js @@ -88,7 +88,10 @@ function loadConfig() { }); nconf.defaults({ - themes_path: path.join(__dirname, 'node_modules') + base_dir: __dirname, + themes_path: path.join(__dirname, 'node_modules'), + upload_url: path.join(path.sep, 'uploads', path.sep), + views_dir: path.join(__dirname, 'public/templates') }); // Ensure themes_path is a full filepath @@ -98,11 +101,6 @@ function loadConfig() { function start() { loadConfig(); - nconf.set('url', nconf.get('base_url') + (nconf.get('use_port') ? ':' + nconf.get('port') : '') + nconf.get('relative_path')); - nconf.set('upload_url', path.join(path.sep, 'uploads', path.sep)); - nconf.set('base_dir', __dirname); - nconf.set('views_dir', path.join(__dirname, 'public/templates')); - winston.info('Time: ' + new Date()); winston.info('Initializing NodeBB v' + pkg.version); winston.info('* using configuration stored in: ' + configFile); @@ -133,6 +131,7 @@ function start() { plugins.init(); translator.loadServer(); + nconf.set('url', nconf.get('base_url') + (nconf.get('use_port') ? ':' + nconf.get('port') : '') + nconf.get('relative_path')); nconf.set('base_templates_path', path.join(nconf.get('themes_path'), 'nodebb-theme-vanilla/templates')); nconf.set('theme_templates_path', meta.config['theme:templates'] ? path.join(nconf.get('themes_path'), meta.config['theme:id'], meta.config['theme:templates']) : nconf.get('base_templates_path')); diff --git a/mocks/databasemock.js b/mocks/databasemock.js index 8c723d31b4..bc6bbbc019 100644 --- a/mocks/databasemock.js +++ b/mocks/databasemock.js @@ -14,6 +14,12 @@ nconf.file({ file: path.join(__dirname, '../config.json') }); + nconf.defaults({ + base_dir: path.join(__dirname,'..'), + themes_path: path.join(__dirname, '../node_modules'), + upload_url: path.join(path.sep, '../uploads', path.sep), + views_dir: path.join(__dirname, '../public/templates') + }); var dbType = nconf.get('database'), testDbConfig = nconf.get('test_database'), @@ -59,7 +65,6 @@ meta = require('../src/meta'); before(function(done) { - db.init(function(err) { //Clean up db.flushdb(function(err) { @@ -71,6 +76,9 @@ winston.info('test_database flushed'); meta.configs.init(function () { + nconf.set('url', nconf.get('base_url') + (nconf.get('use_port') ? ':' + nconf.get('port') : '') + nconf.get('relative_path')); + nconf.set('base_templates_path', path.join(nconf.get('themes_path'), 'nodebb-theme-vanilla/templates')); + nconf.set('theme_templates_path', meta.config['theme:templates'] ? path.join(nconf.get('themes_path'), meta.config['theme:id'], meta.config['theme:templates']) : nconf.get('base_templates_path')); var webserver = require('../src/webserver'), sockets = require('../src/socket.io'); diff --git a/tests/groups.js b/tests/groups.js index deb3b38256..d7f56d4437 100644 --- a/tests/groups.js +++ b/tests/groups.js @@ -95,7 +95,6 @@ describe('Groups', function() { Groups.search('hidden', { showAllGroups: true }, function(err, groups) { - console.log(groups); assert.equal(1, groups.length); assert.strictEqual('Hidden', groups[0].name); done();