You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As 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.
The 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.
I'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.
The text was updated successfully, but these errors were encountered:
That is so puzzling Alex, because I could swear I remember trying that ( just calling destroy ) .. and not using teardown to clear the models. But maybe I didn't .. anyway .. that's a good find, and I will check that out and take out clearing store from teardown if the tests pass for that.
Thanks for the info.
You were right @Grantovich. The store is cleared in App.destroy. Can not believe I did not catch that one.
New version 1.0.3 no longer clears store in TestHelper.teardown
The new documentation in the README includes this part about acceptance testing:
As 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, andApp.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.The 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 replaceTestHelper.teardown()
with a simple$.mockjax.clear()
(since that is the other thing the teardown call does), and that resolved the intermittent failures.I'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.
The text was updated successfully, but these errors were encountered: