Ghost/core/test/unit/middleware/ghost-locals_spec.js
Katharina Irrgang 7bcccc71dc
Moved apps into web folder (#9308)
refs #9178

- move express apps to one place (called `web`)
- requires https://github.com/TryGhost/Ghost-Admin/pull/923
- any further improvements are not part of this PR
- this PR just moves the files and ensures the paths are up-to-date
2017-12-06 17:37:54 +01:00

34 lines
867 B
JavaScript

var should = require('should'),
sinon = require('sinon'),
ghostLocals = require('../../../server/web/middleware/ghost-locals'),
sandbox = sinon.sandbox.create();
describe('Theme Handler', function () {
var req, res, next;
beforeEach(function () {
req = sandbox.spy();
res = sandbox.spy();
next = sandbox.spy();
});
afterEach(function () {
sandbox.restore();
});
describe('ghostLocals', function () {
it('sets all locals', function () {
req.path = '/awesome-post';
ghostLocals(req, res, next);
res.locals.should.be.an.Object();
should.exist(res.locals.version);
should.exist(res.locals.safeVersion);
res.locals.relativeUrl.should.equal(req.path);
next.called.should.be.true();
});
});
});