mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 00:11:49 +03:00
47e00900cc
no issue - change out should.equal for // jshint ignore:line - ensure should is the first require in every test, and ALWAYS require - make sinon the second require, and sandbox the last thing - ALWAYS use sandbox, futureproofs tests against contributors who don't know it - change require formatting
33 lines
1008 B
JavaScript
33 lines
1008 B
JavaScript
var should = require('should'), // jshint ignore:line
|
|
sinon = require('sinon'),
|
|
rewire = require('rewire'),
|
|
Promise = require('bluebird'),
|
|
config = require(__dirname + '/../../../server/config'),
|
|
postScheduling = require(__dirname + '/../../../server/scheduling/post-scheduling'),
|
|
|
|
sandbox = sinon.sandbox.create();
|
|
|
|
describe('Scheduling', function () {
|
|
var scope = {};
|
|
|
|
before(function () {
|
|
sandbox.stub(postScheduling, 'init').returns(Promise.resolve());
|
|
scope.scheduling = rewire(config.get('paths').corePath + '/server/scheduling');
|
|
});
|
|
|
|
after(function () {
|
|
sandbox.restore();
|
|
});
|
|
|
|
describe('success', function () {
|
|
it('ensure post scheduling init is called', function (done) {
|
|
scope.scheduling.init({
|
|
postScheduling: {}
|
|
}).then(function () {
|
|
postScheduling.init.calledOnce.should.eql(true);
|
|
done();
|
|
}).catch(done);
|
|
});
|
|
});
|
|
});
|