* DEV: Use custom tags rather than handlebars server side These will be skipped if they are ever rendered in a document. The handlebars really messes stuff up. * DEV: Build our own locale file for testing purposes We can't practically proxy everything in test mode, but we can approximate the logic and build our own locale file for testing purposes that works quite well. This allows us to run tests without a proxy. * DEV: Support for testem runner for ember cli tests
25 lines
702 B
JavaScript
25 lines
702 B
JavaScript
export default function (helpers) {
|
|
const { response } = helpers;
|
|
const fixturesByUrl = {};
|
|
|
|
// Load any fixtures automatically
|
|
Object.keys(require._eak_seen).forEach((entry) => {
|
|
if (/^discourse\/tests\/fixtures/.test(entry)) {
|
|
const fixture = require(entry, null, null, true);
|
|
if (fixture && fixture.default) {
|
|
const obj = fixture.default;
|
|
Object.keys(obj).forEach((url) => {
|
|
let fixtureUrl = url;
|
|
if (fixtureUrl[0] !== "/") {
|
|
fixtureUrl = "/" + fixtureUrl;
|
|
}
|
|
fixturesByUrl[url] = obj[url];
|
|
this.get(fixtureUrl, () => response(obj[url]));
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
return fixturesByUrl;
|
|
}
|