mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Used sinon.createSandbox rather than global sinon
no-issue
This commit is contained in:
parent
a22d575a9e
commit
f349c5385c
1 changed files with 11 additions and 9 deletions
|
@ -36,13 +36,15 @@ var should = require('should'),
|
||||||
html: '<p>This</p>'
|
html: '<p>This</p>'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const sandbox = sinon.createSandbox();
|
||||||
|
|
||||||
common.i18n.init();
|
common.i18n.init();
|
||||||
|
|
||||||
describe('Mail: Ghostmailer', function () {
|
describe('Mail: Ghostmailer', function () {
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
mailer = null;
|
mailer = null;
|
||||||
configUtils.restore();
|
configUtils.restore();
|
||||||
sinon.restore();
|
sandbox.restore();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should attach mail provider to ghost instance', function () {
|
it('should attach mail provider to ghost instance', function () {
|
||||||
|
@ -182,34 +184,34 @@ describe('Mail: Ghostmailer', function () {
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mailer = new mail.GhostMailer();
|
mailer = new mail.GhostMailer();
|
||||||
sinon.stub(settingsCache, 'get').returns('Test');
|
sandbox.stub(settingsCache, 'get').returns('Test');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('standard domain', function () {
|
it('standard domain', function () {
|
||||||
sinon.stub(urlUtils, 'urlFor').returns('http://default.com');
|
sandbox.stub(urlUtils, 'urlFor').returns('http://default.com');
|
||||||
configUtils.set({mail: {from: null}});
|
configUtils.set({mail: {from: null}});
|
||||||
|
|
||||||
mailer.from().should.equal('"Test" <noreply@default.com>');
|
mailer.from().should.equal('"Test" <noreply@default.com>');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('trailing slash', function () {
|
it('trailing slash', function () {
|
||||||
sinon.stub(urlUtils, 'urlFor').returns('http://default.com/');
|
sandbox.stub(urlUtils, 'urlFor').returns('http://default.com/');
|
||||||
configUtils.set({mail: {from: null}});
|
configUtils.set({mail: {from: null}});
|
||||||
|
|
||||||
mailer.from().should.equal('"Test" <noreply@default.com>');
|
mailer.from().should.equal('"Test" <noreply@default.com>');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('strip port', function () {
|
it('strip port', function () {
|
||||||
sinon.stub(urlUtils, 'urlFor').returns('http://default.com:2368/');
|
sandbox.stub(urlUtils, 'urlFor').returns('http://default.com:2368/');
|
||||||
configUtils.set({mail: {from: null}});
|
configUtils.set({mail: {from: null}});
|
||||||
mailer.from().should.equal('"Test" <noreply@default.com>');
|
mailer.from().should.equal('"Test" <noreply@default.com>');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Escape title', function () {
|
it('Escape title', function () {
|
||||||
settingsCache.get.restore();
|
settingsCache.get.restore();
|
||||||
sinon.stub(settingsCache, 'get').returns('Test"');
|
sandbox.stub(settingsCache, 'get').returns('Test"');
|
||||||
|
|
||||||
sinon.stub(urlUtils, 'urlFor').returns('http://default.com:2368/');
|
sandbox.stub(urlUtils, 'urlFor').returns('http://default.com:2368/');
|
||||||
configUtils.set({mail: {from: null}});
|
configUtils.set({mail: {from: null}});
|
||||||
mailer.from().should.equal('"Test\\"" <noreply@default.com>');
|
mailer.from().should.equal('"Test\\"" <noreply@default.com>');
|
||||||
});
|
});
|
||||||
|
@ -225,7 +227,7 @@ describe('Mail: Ghostmailer', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should attach blog title', function () {
|
it('should attach blog title', function () {
|
||||||
sinon.stub(settingsCache, 'get').returns('Test');
|
sandbox.stub(settingsCache, 'get').returns('Test');
|
||||||
|
|
||||||
configUtils.set({mail: {from: 'from@default.com'}});
|
configUtils.set({mail: {from: 'from@default.com'}});
|
||||||
|
|
||||||
|
@ -252,7 +254,7 @@ describe('Mail: Ghostmailer', function () {
|
||||||
|
|
||||||
it('should use default title if not theme title is provided', function () {
|
it('should use default title if not theme title is provided', function () {
|
||||||
configUtils.set({mail: {from: null}});
|
configUtils.set({mail: {from: null}});
|
||||||
sinon.stub(urlUtils, 'urlFor').returns('http://default.com:2368/');
|
sandbox.stub(urlUtils, 'urlFor').returns('http://default.com:2368/');
|
||||||
|
|
||||||
mailer = new mail.GhostMailer();
|
mailer = new mail.GhostMailer();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue