mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-07 11:30:55 +03:00
7bcccc71dc
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
34 lines
867 B
JavaScript
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();
|
|
});
|
|
});
|
|
});
|