diff --git a/core/test/regression/exporter/exporter_spec.js b/core/test/regression/exporter/exporter_spec.js index 0dc1690799..933eafc3fb 100644 --- a/core/test/regression/exporter/exporter_spec.js +++ b/core/test/regression/exporter/exporter_spec.js @@ -8,8 +8,8 @@ var should = require('should'), ghostVersion = require('../../../server/lib/ghost-version'); describe('Exporter', function () { - before(testUtils.teardown); - afterEach(testUtils.teardown); + before(testUtils.teardownDb); + afterEach(testUtils.teardownDb); afterEach(function () { sinon.restore(); }); diff --git a/core/test/regression/importer/importer_spec.js b/core/test/regression/importer/importer_spec.js index b0d1ced462..c5d8a85568 100644 --- a/core/test/regression/importer/importer_spec.js +++ b/core/test/regression/importer/importer_spec.js @@ -112,13 +112,13 @@ const exportedLegacyBody = () => { // Tests in here do an import for each test describe('Integration: Importer', function () { - before(testUtils.teardown); + before(testUtils.teardownDb); beforeEach(function () { sinon.stub(importer, 'cleanUp'); }); - afterEach(testUtils.teardown); + afterEach(testUtils.teardownDb); afterEach(function () { sinon.restore(); }); @@ -1171,7 +1171,7 @@ describe('Integration: Importer', function () { }); describe('Existing database', function () { - beforeEach(testUtils.teardown); + beforeEach(testUtils.teardownDb); beforeEach(testUtils.setup('users:roles', 'posts', 'settings')); it('import multiple users, tags, posts', function () { @@ -1279,7 +1279,7 @@ describe('Integration: Importer', function () { }); describe('1.0', function () { - beforeEach(testUtils.teardown); + beforeEach(testUtils.teardownDb); beforeEach(testUtils.setup('roles', 'owner', 'settings')); it('ensure amp field get\'s respected', function () { @@ -1514,7 +1514,7 @@ describe('1.0', function () { }); describe('LTS', function () { - beforeEach(testUtils.teardown); + beforeEach(testUtils.teardownDb); beforeEach(testUtils.setup('roles', 'owner', 'settings')); it('disallows importing LTS imports', function () { diff --git a/core/test/regression/migrations/migration_spec.js b/core/test/regression/migrations/migration_spec.js index 96ad891db1..9d40b7633c 100644 --- a/core/test/regression/migrations/migration_spec.js +++ b/core/test/regression/migrations/migration_spec.js @@ -6,8 +6,8 @@ var should = require('should'), Models = require('../../../server/models'); describe('Database Migration (special functions)', function () { - before(testUtils.teardown); - afterEach(testUtils.teardown); + before(testUtils.teardownDb); + afterEach(testUtils.teardownDb); afterEach(function () { sinon.restore(); }); diff --git a/core/test/regression/models/base/listeners_spec.js b/core/test/regression/models/base/listeners_spec.js index 4a840e84da..36b8b4912a 100644 --- a/core/test/regression/models/base/listeners_spec.js +++ b/core/test/regression/models/base/listeners_spec.js @@ -20,7 +20,7 @@ describe('Models: listeners', function () { publishedAtFutureMoment3: moment().add(10, 'hours').startOf('hour') }; - before(testUtils.teardown); + before(testUtils.teardownDb); beforeEach(testUtils.setup('owner', 'settings')); @@ -36,7 +36,7 @@ describe('Models: listeners', function () { common.events.on.restore(); sinon.restore(); scope.posts = []; - return testUtils.teardown(); + return testUtils.teardownDb(); }); describe('on timezone changed', function () { diff --git a/core/test/regression/models/model_posts_spec.js b/core/test/regression/models/model_posts_spec.js index 3127899799..6f8dc93875 100644 --- a/core/test/regression/models/model_posts_spec.js +++ b/core/test/regression/models/model_posts_spec.js @@ -25,9 +25,9 @@ var should = require('should'), describe('Post Model', function () { var eventsTriggered = {}; - before(testUtils.teardown); + before(testUtils.teardownDb); before(testUtils.stopGhost); - after(testUtils.teardown); + after(testUtils.teardownDb); before(testUtils.setup('users:roles')); @@ -1543,10 +1543,10 @@ describe('Post Model', function () { }); describe('Multiauthor Posts', function () { - before(testUtils.teardown); + before(testUtils.teardownDb); after(function () { - return testUtils.teardown() + return testUtils.teardownDb() .then(function () { return testUtils.setup('users:roles')(); }); diff --git a/core/test/regression/models/model_users_spec.js b/core/test/regression/models/model_users_spec.js index ac63ef2466..4652e977a4 100644 --- a/core/test/regression/models/model_users_spec.js +++ b/core/test/regression/models/model_users_spec.js @@ -14,8 +14,8 @@ var should = require('should'), describe('User Model', function run() { var eventsTriggered = {}; - before(testUtils.teardown); - afterEach(testUtils.teardown); + before(testUtils.teardownDb); + afterEach(testUtils.teardownDb); afterEach(function () { sinon.restore(); }); diff --git a/core/test/regression/site/UrlService_spec.js b/core/test/regression/site/UrlService_spec.js index b32f998593..25087d4eba 100644 --- a/core/test/regression/site/UrlService_spec.js +++ b/core/test/regression/site/UrlService_spec.js @@ -20,9 +20,9 @@ describe('Integration: services/url/UrlService', function () { }); }); - before(testUtils.teardown); + before(testUtils.teardownDb); before(testUtils.setup('users:roles', 'posts')); - after(testUtils.teardown); + after(testUtils.teardownDb); after(function () { sinon.restore(); @@ -205,7 +205,7 @@ describe('Integration: services/url/UrlService', function () { describe('functional: extended/modified routing set', function () { let router1, router2, router3, router4, router5; - before(testUtils.teardown); + before(testUtils.teardownDb); before(testUtils.setup('users:roles', 'posts')); before(function () { diff --git a/core/test/regression/site/dynamic_routing_spec.js b/core/test/regression/site/dynamic_routing_spec.js index a7e26562a7..75a52cff58 100644 --- a/core/test/regression/site/dynamic_routing_spec.js +++ b/core/test/regression/site/dynamic_routing_spec.js @@ -95,7 +95,7 @@ describe('Dynamic Routing', function () { }); describe('RSS', function () { - before(testUtils.teardown); + before(testUtils.teardownDb); before(function (done) { testUtils.initData().then(function () { @@ -105,7 +105,7 @@ describe('Dynamic Routing', function () { }); }); - after(testUtils.teardown); + after(testUtils.teardownDb); it('should 301 redirect with CC=1year without slash', function (done) { request.get('/rss') @@ -186,7 +186,7 @@ describe('Dynamic Routing', function () { }).catch(done); }); - after(testUtils.teardown); + after(testUtils.teardownDb); it('should return HTML for valid route', function (done) { request.get('/tag/getting-started/') @@ -326,7 +326,7 @@ describe('Dynamic Routing', function () { // Inserting more posts takes a bit longer this.timeout(20000); - before(testUtils.teardown); + before(testUtils.teardownDb); // Add enough posts to trigger pages before(function (done) { @@ -341,7 +341,7 @@ describe('Dynamic Routing', function () { }).catch(done); }); - after(testUtils.teardown); + after(testUtils.teardownDb); it('should redirect without slash', function (done) { request.get('/tag/injection/page/2') @@ -459,7 +459,7 @@ describe('Dynamic Routing', function () { }).catch(done); }); - after(testUtils.teardown); + after(testUtils.teardownDb); it('should 404 for /author/ route', function (done) { request.get('/author/') @@ -621,7 +621,7 @@ describe('Dynamic Routing', function () { }).catch(done); }); - after(testUtils.teardown); + after(testUtils.teardownDb); it('should redirect without slash', function (done) { request.get('/author/ghost-owner/page/2') @@ -703,7 +703,7 @@ describe('Dynamic Routing', function () { }).catch(done); }); - after(testUtils.teardown); + after(testUtils.teardownDb); after(function () { return ghostServer.stop(); }); diff --git a/core/test/regression/site/site_spec.js b/core/test/regression/site/site_spec.js index 0479e0472c..a347c73d19 100644 --- a/core/test/regression/site/site_spec.js +++ b/core/test/regression/site/site_spec.js @@ -14,7 +14,7 @@ describe('Integration - Web - Site', function () { let app; before(testUtils.integrationTesting.urlService.resetGenerators); - before(testUtils.teardown); + before(testUtils.teardownDb); before(testUtils.setup('users:roles', 'posts')); describe('v2', function () { @@ -1223,7 +1223,7 @@ describe('Integration - Web - Site', function () { describe('extended routes.yaml: routes', function () { describe('channels', function () { before(testUtils.integrationTesting.urlService.resetGenerators); - before(testUtils.teardown); + before(testUtils.teardownDb); before(testUtils.setup('users:roles', 'posts')); before(function () { @@ -2923,7 +2923,7 @@ describe('Integration - Web - Site', function () { describe('extended routes.yaml: routes', function () { describe('channels', function () { before(testUtils.integrationTesting.urlService.resetGenerators); - before(testUtils.teardown); + before(testUtils.teardownDb); before(testUtils.setup('users:roles', 'posts')); before(function () { @@ -4623,7 +4623,7 @@ describe('Integration - Web - Site', function () { describe('extended routes.yaml: routes', function () { describe('channels', function () { before(testUtils.integrationTesting.urlService.resetGenerators); - before(testUtils.teardown); + before(testUtils.teardownDb); before(testUtils.setup('users:roles', 'posts')); before(function () { diff --git a/core/test/regression/update-check/update_check_spec.js b/core/test/regression/update-check/update_check_spec.js index 74fbb8f944..ee2a36d9b5 100644 --- a/core/test/regression/update-check/update_check_spec.js +++ b/core/test/regression/update-check/update_check_spec.js @@ -24,14 +24,14 @@ describe('Update Check', function () { configUtils.restore(); }); - after(testUtils.teardown); + after(testUtils.teardownDb); describe('fn: updateCheck', function () { var updateCheckRequestSpy, updateCheckResponseSpy, updateCheckErrorSpy; - beforeEach(testUtils.teardown); + beforeEach(testUtils.teardownDb); beforeEach(testUtils.setup('roles', 'owner')); beforeEach(function () { @@ -117,7 +117,7 @@ describe('Update Check', function () { configUtils.restore(); }); - beforeEach(testUtils.teardown); + beforeEach(testUtils.teardownDb); beforeEach(testUtils.setup('roles', 'owner', 'settings', 'posts', 'perms:setting', 'perms:user', 'perms:init')); it('should report the correct data', function (done) { @@ -155,7 +155,7 @@ describe('Update Check', function () { updateCheck.__set__('ghostVersion.original', currentVersionOrig); }); - beforeEach(testUtils.teardown); + beforeEach(testUtils.teardownDb); beforeEach(testUtils.setup('settings', 'roles', 'owner', 'perms:setting', 'perms:notification', 'perms:user', 'perms:init')); beforeEach(function () { @@ -321,7 +321,7 @@ describe('Update Check', function () { }); describe('fn: updateCheckResponse', function () { - beforeEach(testUtils.teardown); + beforeEach(testUtils.teardownDb); beforeEach(testUtils.setup('roles', 'settings', 'perms:setting', 'perms:init')); it('receives a notifications with messages', function (done) { diff --git a/core/test/utils/index.js b/core/test/utils/index.js index f5559749f6..485dd023b8 100644 --- a/core/test/utils/index.js +++ b/core/test/utils/index.js @@ -43,7 +43,7 @@ var Promise = require('bluebird'), mockNotExistingModule, unmockNotExistingModule, - teardown, + teardownDb, setup, truncate, createUser, @@ -738,7 +738,7 @@ createPost = function createPost(options) { * Has to run in a transaction for MySQL, otherwise the foreign key check does not work. * Sqlite3 has no truncate command. */ -teardown = function teardown() { +teardownDb = function teardownDb() { debug('Database teardown'); urlService.softReset(); @@ -855,7 +855,7 @@ startGhost = function startGhost(options) { // truncate database and re-run fixtures // we have to ensure that some components in Ghost are reloaded if (ghostServer && ghostServer.httpServer && !options.forceStart) { - return teardown() + return teardownDb() .then(function () { return knexMigrator.init({only: 2}); }) @@ -1101,7 +1101,7 @@ module.exports = { } } }, - teardown: teardown, + teardownDb: teardownDb, truncate: truncate, setup: setup, createUser: createUser,