Split up pretender a bit. It was getting unwieldly.

This commit is contained in:
Robin Ward
2015-12-01 15:31:15 -05:00
parent 868079f2a8
commit 2006be41cf
4 changed files with 109 additions and 99 deletions

View File

@ -0,0 +1,20 @@
export default function(helpers) {
const { response } = helpers;
const fixturesByUrl = {};
// Load any fixtures automatically
Ember.keys(require._eak_seen).forEach(entry => {
if (/^fixtures/.test(entry)) {
const fixture = require(entry, null, null, true);
if (fixture && fixture.default) {
const obj = fixture.default;
Ember.keys(obj).forEach(url => {
fixturesByUrl[url] = obj[url];
this.get(url, () => response(obj[url]));
});
}
}
});
return fixturesByUrl;
};