diff --git a/ghost/limit-service/lib/limit.js b/ghost/limit-service/lib/limit.js index cab8ff23ea..6edab24f1f 100644 --- a/ghost/limit-service/lib/limit.js +++ b/ghost/limit-service/lib/limit.js @@ -1,6 +1,7 @@ const errors = require('@tryghost/errors'); -const _ = require('lodash'); +// run in context allows us to change the templateSettings without causing havoc +const _ = require('lodash').runInContext(); _.templateSettings.interpolate = /{{([\s\S]+?)}}/g; class Limit { diff --git a/ghost/limit-service/test/hello.test.js b/ghost/limit-service/test/hello.test.js deleted file mode 100644 index 85d69d1e08..0000000000 --- a/ghost/limit-service/test/hello.test.js +++ /dev/null @@ -1,10 +0,0 @@ -// Switch these lines once there are useful utils -// const testUtils = require('./utils'); -require('./utils'); - -describe('Hello world', function () { - it('Runs a test', function () { - // TODO: Write me! - 'hello'.should.eql('hello'); - }); -}); diff --git a/ghost/limit-service/test/template.test.js b/ghost/limit-service/test/template.test.js new file mode 100644 index 0000000000..9af1622970 --- /dev/null +++ b/ghost/limit-service/test/template.test.js @@ -0,0 +1,12 @@ +// Switch these lines once there are useful utils +// const testUtils = require('./utils'); +require('./utils'); + +describe('Lodash Template', function () { + it('Does not get clobbered by this lib', function () { + require('../lib/limit'); + let _ = require('lodash'); + + _.templateSettings.interpolate.should.eql(/<%=([\s\S]+?)%>/g); + }); +});