mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 23:21:11 +08:00
Split up pretender a bit. It was getting unwieldly.
This commit is contained in:
20
test/javascripts/helpers/fixture-pretender.js.es6
Normal file
20
test/javascripts/helpers/fixture-pretender.js.es6
Normal 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;
|
||||
};
|
Reference in New Issue
Block a user