2020-09-04 13:42:47 +02:00
|
|
|
export default function (helpers) {
|
2015-12-01 15:31:15 -05:00
|
|
|
const { response } = helpers;
|
|
|
|
const fixturesByUrl = {};
|
|
|
|
|
|
|
|
// Load any fixtures automatically
|
2020-09-04 13:42:47 +02: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;
|
2020-09-04 13:42:47 +02: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;
|
2018-06-15 17:03:24 +02:00
|
|
|
}
|