After playing around with the Ember Data Factory, I realized that ember-data has today no convenient way to reset the adapter (or better the storage behind the adapter). To have a rspec / factory-girl like behavior with Ember Data Factory, I would propose an ApplicationAdapter.reset()
method (like App.reset()
) to reset the storage behind an adapter.
For the FIXTUREAdapater this could reset all fixtures:
App.__container__.lookup('dataAdapter:main')
.getModelTypes().forEach(function(type) {
type.FIXTURES = [];
});
some adapters could provide the same behavior also out of the box (localStorage.clear(), etc.), others could allow to overwrite the reset function with an own implementation like teddyzeenny: https://github.com/teddyzeenny/ember-data-factory/issues/4#issuecomment-26702456
What do you think?