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