According to http://wiki.sproutcore.com/w/page/12412884/DataStore-Using%20Fixtures fixtures are meant for being used in tests (and "hacking away" :)
Now, when I load fixtures in my test setup (using jasmine) like so:
App.store = SC.Store.create().from(SC.Record.fixtures);
and I modify any record in a test case like so:
then this seems to modify the underlying fixture data object so that in subsequent record.get('foo') will still yield 'bar'.
Erich Ocean's answer on the mailing list:
"Unfortunately you are correct. The copy thing (if that turns out to be
what is happening) could be corrected, but it is not currently
possible in the shipping version of the datastore to "reset"
everything. Various items are stored in places that are not removed
when an SC.Store instance is destroyed. All of these can be fixed
should someone want to take the time; it is an implementation issue,
not an issue with the architecture of the store itself."
Btw a workaround seems to be to do the following after each test case:
Travis.store.dataSource._fixtures = null;
Interesting. Seems like it shouldn't be hard to automate that.
@svenfuchs, would a MyApp.store.reset() function do the trick? I could probably set one up that calls reset on the dataSource which in this case would be set up to clear out _fixtures.
Added a DataSource reset function for fixtures - Fixes #408
I just added a reset function to the fixtures data source. I also updated SC.Store.reset to call the reset on the datasource if it has one. So, you should be able to set up a teardown in your test modules that calls Travis.store.reset(). Hope that helps.