mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
Removed redundant theme engine stubbing in tests
refs https://github.com/TryGhost/Team/issues/948 - When working on related problem noticed these declarations were scattered all over the place in the test without special purpose. Moved them all up into a central "once per suite" stub. Not sure if this subing is working at all, but at least it will be easier to change it once per suite in the future once someone spots a problem with this approach
This commit is contained in:
parent
b20c88b3e3
commit
e2c78e0634
@ -28,9 +28,6 @@ describe('Integration - Web - Site canary', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('canary');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
})
|
||||
@ -45,12 +42,15 @@ describe('Integration - Web - Site canary', function () {
|
||||
});
|
||||
|
||||
beforeEach(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('canary');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
const postsAPI = require('../../../../core/server/api/canary/posts-public');
|
||||
postSpy = sinon.spy(postsAPI.browse, 'query');
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
postSpy.restore();
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
after(function () {
|
||||
@ -397,9 +397,6 @@ describe('Integration - Web - Site canary', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('canary');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -516,9 +513,6 @@ describe('Integration - Web - Site canary', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('canary');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -577,9 +571,6 @@ describe('Integration - Web - Site canary', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('canary');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -679,9 +670,6 @@ describe('Integration - Web - Site canary', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('canary');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -765,9 +753,6 @@ describe('Integration - Web - Site canary', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('canary');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -923,9 +908,6 @@ describe('Integration - Web - Site canary', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('canary');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -1040,9 +1022,6 @@ describe('Integration - Web - Site canary', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('canary');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -1055,9 +1034,6 @@ describe('Integration - Web - Site canary', function () {
|
||||
afterEach(function () {
|
||||
configUtils.restore();
|
||||
urlUtils.restore();
|
||||
});
|
||||
|
||||
after(function () {
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
@ -1110,9 +1086,6 @@ describe('Integration - Web - Site canary', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('canary');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -1169,9 +1142,6 @@ describe('Integration - Web - Site canary', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('canary');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -1184,9 +1154,6 @@ describe('Integration - Web - Site canary', function () {
|
||||
afterEach(function () {
|
||||
configUtils.restore();
|
||||
urlUtils.restore();
|
||||
});
|
||||
|
||||
after(function () {
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
@ -1355,7 +1322,6 @@ describe('Integration - Web - Site canary', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('canary');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(10);
|
||||
|
||||
app = siteApp({start: true});
|
||||
@ -1605,9 +1571,6 @@ describe('Integration - Web - Site canary', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('canary');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
|
@ -28,9 +28,6 @@ describe('Integration - Web - Site v2', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v2');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
})
|
||||
@ -45,18 +42,20 @@ describe('Integration - Web - Site v2', function () {
|
||||
});
|
||||
|
||||
beforeEach(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v2');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
const postsAPI = require('../../../../core/server/api/v2/posts-public');
|
||||
postSpy = sinon.spy(postsAPI.browse, 'query');
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
postSpy.restore();
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
after(function () {
|
||||
configUtils.restore();
|
||||
urlUtils.restore();
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
describe('behaviour: default cases', function () {
|
||||
@ -397,9 +396,6 @@ describe('Integration - Web - Site v2', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v2');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -514,9 +510,6 @@ describe('Integration - Web - Site v2', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v2');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -575,9 +568,6 @@ describe('Integration - Web - Site v2', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v2');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -677,9 +667,6 @@ describe('Integration - Web - Site v2', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v2');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -763,9 +750,6 @@ describe('Integration - Web - Site v2', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v2');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -921,9 +905,6 @@ describe('Integration - Web - Site v2', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v2');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -1038,9 +1019,6 @@ describe('Integration - Web - Site v2', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v2');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -1108,9 +1086,6 @@ describe('Integration - Web - Site v2', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v2');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -1167,9 +1142,6 @@ describe('Integration - Web - Site v2', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v2');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -1353,7 +1325,6 @@ describe('Integration - Web - Site v2', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v2');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(10);
|
||||
|
||||
app = siteApp({start: true});
|
||||
@ -1603,9 +1574,6 @@ describe('Integration - Web - Site v2', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v2');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
|
@ -28,9 +28,6 @@ describe('Integration - Web - Site v3', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v3');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
})
|
||||
@ -45,18 +42,20 @@ describe('Integration - Web - Site v3', function () {
|
||||
});
|
||||
|
||||
beforeEach(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v3');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
const postsAPI = require('../../../../core/server/api/v3/posts-public');
|
||||
postSpy = sinon.spy(postsAPI.browse, 'query');
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
postSpy.restore();
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
after(function () {
|
||||
configUtils.restore();
|
||||
urlUtils.restore();
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
describe('behaviour: default cases', function () {
|
||||
@ -399,9 +398,6 @@ describe('Integration - Web - Site v3', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v3');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -516,9 +512,6 @@ describe('Integration - Web - Site v3', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v3');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -577,9 +570,6 @@ describe('Integration - Web - Site v3', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v3');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -679,9 +669,6 @@ describe('Integration - Web - Site v3', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v3');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -765,9 +752,6 @@ describe('Integration - Web - Site v3', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v3');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -923,9 +907,6 @@ describe('Integration - Web - Site v3', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v3');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -1040,9 +1021,6 @@ describe('Integration - Web - Site v3', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v3');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -1110,9 +1088,6 @@ describe('Integration - Web - Site v3', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v3');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -1169,9 +1144,6 @@ describe('Integration - Web - Site v3', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v3');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
@ -1355,7 +1327,6 @@ describe('Integration - Web - Site v3', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v3');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(10);
|
||||
|
||||
app = siteApp({start: true});
|
||||
@ -1606,9 +1577,6 @@ describe('Integration - Web - Site v3', function () {
|
||||
|
||||
return testUtils.integrationTesting.initGhost()
|
||||
.then(function () {
|
||||
sinon.stub(themeEngine.getActive(), 'engine').withArgs('ghost-api').returns('v3');
|
||||
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(2);
|
||||
|
||||
app = siteApp({start: true});
|
||||
return testUtils.integrationTesting.urlServiceInitAndWait();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user