2013-09-06 20:07:25 +04:00
|
|
|
/*globals describe, beforeEach, afterEach, before, it*/
|
|
|
|
var testUtils = require('./testUtils'),
|
2013-08-05 19:11:32 +04:00
|
|
|
should = require('should'),
|
|
|
|
sinon = require('sinon'),
|
2013-09-06 20:07:25 +04:00
|
|
|
_ = require("underscore"),
|
|
|
|
when = require('when'),
|
2013-08-05 19:11:32 +04:00
|
|
|
errors = require('../../server/errorHandling'),
|
2013-09-06 20:07:25 +04:00
|
|
|
|
|
|
|
// Stuff we are testing
|
2013-08-05 19:11:32 +04:00
|
|
|
plugins = require('../../server/plugins'),
|
|
|
|
GhostPlugin = plugins.GhostPlugin,
|
2013-09-18 22:49:10 +04:00
|
|
|
loader = require('../../server/plugins/loader');
|
2013-08-05 19:11:32 +04:00
|
|
|
|
|
|
|
describe('Plugins', function () {
|
|
|
|
|
2013-09-07 05:29:03 +04:00
|
|
|
var sandbox;
|
|
|
|
|
2013-08-05 19:11:32 +04:00
|
|
|
before(function (done) {
|
2013-09-06 20:07:25 +04:00
|
|
|
testUtils.clearData().then(function () {
|
2013-08-25 00:51:58 +04:00
|
|
|
done();
|
|
|
|
}, done);
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(function (done) {
|
2013-09-07 05:29:03 +04:00
|
|
|
sandbox = sinon.sandbox.create();
|
|
|
|
|
2013-09-06 20:07:25 +04:00
|
|
|
testUtils.initData().then(function () {
|
2013-08-25 00:51:58 +04:00
|
|
|
done();
|
|
|
|
}, done);
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(function (done) {
|
2013-09-07 05:29:03 +04:00
|
|
|
sandbox.restore();
|
|
|
|
|
2013-09-06 20:07:25 +04:00
|
|
|
testUtils.clearData().then(function () {
|
2013-08-05 19:11:32 +04:00
|
|
|
done();
|
|
|
|
}, done);
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('GhostPlugin Class', function () {
|
|
|
|
|
|
|
|
should.exist(GhostPlugin);
|
|
|
|
|
|
|
|
it('sets app instance', function () {
|
|
|
|
var fakeGhost = {fake: true},
|
|
|
|
plugin = new GhostPlugin(fakeGhost);
|
|
|
|
|
|
|
|
plugin.app.should.equal(fakeGhost);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('has default install, uninstall, activate and deactivate methods', function () {
|
|
|
|
var fakeGhost = {fake: true},
|
|
|
|
plugin = new GhostPlugin(fakeGhost);
|
|
|
|
|
|
|
|
_.isFunction(plugin.install).should.equal(true);
|
|
|
|
_.isFunction(plugin.uninstall).should.equal(true);
|
|
|
|
_.isFunction(plugin.activate).should.equal(true);
|
|
|
|
_.isFunction(plugin.deactivate).should.equal(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|