{"action":"closed","issue":{"url":"https://api.github.com/repos/danielspaniel/ember-data-factory-guy/issues/73","labels_url":"https://api.github.com/repos/danielspaniel/ember-data-factory-guy/issues/73/labels{/name}","comments_url":"https://api.github.com/repos/danielspaniel/ember-data-factory-guy/issues/73/comments","events_url":"https://api.github.com/repos/danielspaniel/ember-data-factory-guy/issues/73/events","html_url":"https://github.com/danielspaniel/ember-data-factory-guy/issues/73","id":68744653,"number":73,"title":"Unloading records in teardown causes intermittent failure","user":{"login":"grantovich","id":394835,"avatar_url":"https://avatars.githubusercontent.com/u/394835?v=3","gravatar_id":"","url":"https://api.github.com/users/grantovich","html_url":"https://github.com/grantovich","followers_url":"https://api.github.com/users/grantovich/followers","following_url":"https://api.github.com/users/grantovich/following{/other_user}","gists_url":"https://api.github.com/users/grantovich/gists{/gist_id}","starred_url":"https://api.github.com/users/grantovich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grantovich/subscriptions","organizations_url":"https://api.github.com/users/grantovich/orgs","repos_url":"https://api.github.com/users/grantovich/repos","events_url":"https://api.github.com/users/grantovich/events{/privacy}","received_events_url":"https://api.github.com/users/grantovich/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-15T17:46:51Z","updated_at":"2015-04-16T16:34:33Z","closed_at":"2015-04-16T16:34:33Z","body":"The new documentation in the README includes this part about acceptance testing:\r\n\r\n```\r\n  teardown: function () {\r\n    Ember.run(function () {\r\n      TestHelper.teardown();\r\n      App.destroy();\r\n    });\r\n  }\r\n```\r\n\r\nAs part of the `TestHelper.teardown` call, Factory Guy unloads all records from the store. The problem is that the app is still running at this point, and `App.destroy` is asynchronous and does not destroy the app immediately. Unloading the records can therefore raise errors (e.g. in computed properties that depend on associations) and cause tests to fail.\r\n\r\nThe thing is, `App.destroy` seems to already unload all records from the store. I tested this by commenting out the teardown line, and observing that the count of local records was reset to 0 by the time each new test started. I am not using the fixture adapter so maybe things would be different there, but in my case I was able to replace `TestHelper.teardown()` with a simple `$.mockjax.clear()` (since that is the other thing the teardown call does), and that resolved the intermittent failures.\r\n\r\nI'm not sure if this means the record unloading could safely be removed for everyone, just noting that it caused a problem for me and doesn't seem to be strictly necessary."}}