Ghost/core/test/unit/plugins_spec.js
William Dibbern 702a016547 Fixed intermittent test errors
Fixes #1124

- Updated default mocha timeout to 15 seconds. Any future tests that
depend on a timeout (and thus might be better off with a lower value)
can override the default setting which is now 15 seconds.
- Removed test-specific timeout overrides for the mocha tests.
- Fixed the editor/splitbutton tests to wait for the appropriate
selector instead of assuming the dom has been updated immediately.
Should resolve intermittent timeouts when checking the splitbutton's
applied classes.
2013-10-16 17:57:52 -05:00

61 lines
1.7 KiB
JavaScript

/*globals describe, beforeEach, afterEach, before, it*/
var testUtils = require('./testUtils'),
should = require('should'),
sinon = require('sinon'),
_ = require("underscore"),
when = require('when'),
errors = require('../../server/errorHandling'),
// Stuff we are testing
plugins = require('../../server/plugins'),
GhostPlugin = plugins.GhostPlugin,
loader = require('../../server/plugins/loader');
describe('Plugins', function () {
var sandbox;
before(function (done) {
testUtils.clearData().then(function () {
done();
}, done);
});
beforeEach(function (done) {
sandbox = sinon.sandbox.create();
testUtils.initData().then(function () {
done();
}, done);
});
afterEach(function (done) {
sandbox.restore();
testUtils.clearData().then(function () {
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);
});
});
});