var should = require('should'), sinon = require('sinon'), // Stuff we are testing helpers = require('../../../server/helpers'), proxy = require('../../../server/helpers/proxy'), settingsCache = proxy.settingsCache, sandbox = sinon.sandbox.create(); describe('{{ghost_foot}} helper', function () { var settingsCacheStub; afterEach(function () { sandbox.restore(); }); beforeEach(function () { settingsCacheStub = sandbox.stub(settingsCache, 'get'); }); it('outputs global injected code', function (done) { settingsCacheStub.withArgs('ghost_foot').returns(''); helpers.ghost_foot({data: {}}).then(function (rendered) { should.exist(rendered); rendered.string.should.match(/'); helpers.ghost_foot({ data: { root: { post: { codeinjection_foot: 'post-codeinjection' } } } }).then(function (rendered) { should.exist(rendered); rendered.string.should.match(/'); helpers.ghost_foot({ data: { root: { post: { codeinjection_foot: null } } } }).then(function (rendered) { should.exist(rendered); rendered.string.should.match(/'); helpers.ghost_foot({ data: { root: { post: { codeinjection_foot: '' } } } }).then(function (rendered) { should.exist(rendered); rendered.string.should.match(/