2015-12-01 15:31:15 -05:00
|
|
|
export default function(helpers) {
|
|
|
|
const { response } = helpers;
|
|
|
|
const fixturesByUrl = {};
|
|
|
|
|
|
|
|
// Load any fixtures automatically
|
2016-04-28 16:37:20 -04:00
|
|
|
Object.keys(require._eak_seen).forEach(entry => {
|
2015-12-01 15:31:15 -05:00
|
|
|
if (/^fixtures/.test(entry)) {
|
|
|
|
const fixture = require(entry, null, null, true);
|
|
|
|
if (fixture && fixture.default) {
|
|
|
|
const obj = fixture.default;
|
2016-04-28 16:37:20 -04:00
|
|
|
Object.keys(obj).forEach(url => {
|
2015-12-01 15:31:15 -05:00
|
|
|
fixturesByUrl[url] = obj[url];
|
|
|
|
this.get(url, () => response(obj[url]));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return fixturesByUrl;
|
|
|
|
};
|