From 6c9682cdd95001e5228a8aaca6e3fd24fa45a281 Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Tue, 9 Jun 2015 22:46:26 -0500 Subject: [PATCH] Make sure done() is called from before hooks --- core/test/functional/module/module_spec.js | 16 ++++------------ .../functional/routes/api/authentication_spec.js | 5 +---- core/test/functional/routes/api/db_spec.js | 5 +---- core/test/functional/routes/api/error_spec.js | 2 +- .../functional/routes/api/notifications_spec.js | 5 +---- core/test/functional/routes/api/posts_spec.js | 5 +---- core/test/functional/routes/api/settings_spec.js | 5 +---- core/test/functional/routes/api/slugs_spec.js | 5 +---- core/test/functional/routes/api/tags_spec.js | 5 +---- core/test/functional/routes/api/users_spec.js | 5 +---- 10 files changed, 13 insertions(+), 45 deletions(-) diff --git a/core/test/functional/module/module_spec.js b/core/test/functional/module/module_spec.js index 4adcc548e1..582ac3ded6 100644 --- a/core/test/functional/module/module_spec.js +++ b/core/test/functional/module/module_spec.js @@ -13,9 +13,7 @@ describe('Module', function () { should.exist(ghostServer); done(); - }).catch(function (e) { - done(e); - }); + }).catch(done); }); it('should expose an express instance', function (done) { @@ -24,9 +22,7 @@ describe('Module', function () { should.exist(ghostServer.rootApp); done(); - }).catch(function (e) { - done(e); - }); + }).catch(done); }); it('should expose configuration values', function (done) { @@ -39,9 +35,7 @@ describe('Module', function () { should.equal(ghostServer.config.paths.subdir, ''); done(); - }).catch(function (e) { - done(e); - }); + }).catch(done); }); it('should have start/stop/restart functions', function (done) { @@ -52,9 +46,7 @@ describe('Module', function () { ghostServer.stop.should.be.a.Function; done(); - }).catch(function (e) { - done(e); - }); + }).catch(done); }); }); }); diff --git a/core/test/functional/routes/api/authentication_spec.js b/core/test/functional/routes/api/authentication_spec.js index 29e81fc71a..13b775acc3 100644 --- a/core/test/functional/routes/api/authentication_spec.js +++ b/core/test/functional/routes/api/authentication_spec.js @@ -20,10 +20,7 @@ describe('Authentication API', function () { }).then(function (token) { accesstoken = token; done(); - }).catch(function (e) { - console.log('Ghost Error: ', e); - console.log(e.stack); - }); + }).catch(done); }); after(function (done) { diff --git a/core/test/functional/routes/api/db_spec.js b/core/test/functional/routes/api/db_spec.js index ca5e752b2f..5928b8a797 100644 --- a/core/test/functional/routes/api/db_spec.js +++ b/core/test/functional/routes/api/db_spec.js @@ -19,10 +19,7 @@ describe('DB API', function () { }).then(function (token) { accesstoken = token; done(); - }).catch(function (e) { - console.log('Ghost Error: ', e); - console.log(e.stack); - }); + }).catch(done); }); after(function (done) { diff --git a/core/test/functional/routes/api/error_spec.js b/core/test/functional/routes/api/error_spec.js index 2bde922b87..321b50dc36 100644 --- a/core/test/functional/routes/api/error_spec.js +++ b/core/test/functional/routes/api/error_spec.js @@ -18,7 +18,7 @@ describe('Unauthorized', function () { request = supertest.agent(ghostServer.rootApp); done(); - }); + }).catch(done); }); after(function (done) { diff --git a/core/test/functional/routes/api/notifications_spec.js b/core/test/functional/routes/api/notifications_spec.js index d1eecd8959..cd93bf7686 100644 --- a/core/test/functional/routes/api/notifications_spec.js +++ b/core/test/functional/routes/api/notifications_spec.js @@ -20,10 +20,7 @@ describe('Notifications API', function () { }).then(function (token) { accesstoken = token; done(); - }).catch(function (e) { - console.log('Ghost Error: ', e); - console.log(e.stack); - }); + }).catch(done); }); after(function (done) { diff --git a/core/test/functional/routes/api/posts_spec.js b/core/test/functional/routes/api/posts_spec.js index f88657dc7e..3f2e166f37 100644 --- a/core/test/functional/routes/api/posts_spec.js +++ b/core/test/functional/routes/api/posts_spec.js @@ -22,10 +22,7 @@ describe('Post API', function () { }).then(function (token) { accesstoken = token; done(); - }).catch(function (e) { - console.log('Ghost Error: ', e); - console.log(e.stack); - }); + }).catch(done); }); after(function (done) { diff --git a/core/test/functional/routes/api/settings_spec.js b/core/test/functional/routes/api/settings_spec.js index c90add08ca..c6d020afdc 100644 --- a/core/test/functional/routes/api/settings_spec.js +++ b/core/test/functional/routes/api/settings_spec.js @@ -21,10 +21,7 @@ describe('Settings API', function () { }).then(function (token) { accesstoken = token; done(); - }).catch(function (e) { - console.log('Ghost Error: ', e); - console.log(e.stack); - }); + }).catch(done); }); after(function (done) { diff --git a/core/test/functional/routes/api/slugs_spec.js b/core/test/functional/routes/api/slugs_spec.js index 2a1388a9c8..028f56e1eb 100644 --- a/core/test/functional/routes/api/slugs_spec.js +++ b/core/test/functional/routes/api/slugs_spec.js @@ -21,10 +21,7 @@ describe('Slug API', function () { }).then(function (token) { accesstoken = token; done(); - }).catch(function (e) { - console.log('Ghost Error: ', e); - console.log(e.stack); - }); + }).catch(done); }); after(function (done) { diff --git a/core/test/functional/routes/api/tags_spec.js b/core/test/functional/routes/api/tags_spec.js index 7edc505e14..d733e3585f 100644 --- a/core/test/functional/routes/api/tags_spec.js +++ b/core/test/functional/routes/api/tags_spec.js @@ -21,10 +21,7 @@ describe('Tag API', function () { }).then(function (token) { accesstoken = token; done(); - }).catch(function (e) { - console.log('Ghost Error: ', e); - console.log(e.stack); - }); + }).catch(done); }); after(function (done) { diff --git a/core/test/functional/routes/api/users_spec.js b/core/test/functional/routes/api/users_spec.js index ee3c761504..92f16c0b96 100644 --- a/core/test/functional/routes/api/users_spec.js +++ b/core/test/functional/routes/api/users_spec.js @@ -21,10 +21,7 @@ describe('User API', function () { }).then(function (token) { accesstoken = token; done(); - }).catch(function (e) { - console.log('Ghost Error: ', e); - console.log(e.stack); - }); + }).catch(done); }); after(function (done) {