mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 21:19:41 -06:00
84c2c2f477
Previously, `resetSite()` would immediately generate a new `Site` instance, and run all the initialization logic within the model. This included initializing Category objects. This was problematic because `resetSite()` is called before any initializers have been run. That means that any modifications to the Site or Category classes would not have any effect on the already-initialized Site/Category instances. This commit makes two main changes so so that the test environment is more production-like: 1. Update `resetSite` so that it simply stores the new data in the PreloadStore, and destroys the old Site instance. Initialization of a new site instance happens 'just in time' (normally during the `inject-discourse-objects` initializer) 2. Update the `helperContext` in tests to use getters. This avoids the need to look up `Site.current()` before initializers have run It also makes a minor adjustment to one test which was relying on a side-effect of the previous behavior. This should resolve the failing tests for discourse-category-expert under Ember-CLI: https://github.com/discourse/discourse-category-experts/pull/69 |
||
---|---|---|
.. | ||
assets | ||
controllers | ||
helpers | ||
jobs | ||
mailers | ||
models | ||
serializers | ||
services | ||
views |