FIX: Rather than using `singleton: false` for avoiding caching in the

container, just unregister it afterwards.
This commit is contained in:
Robin Ward 2014-04-15 13:03:20 -04:00
parent c9c95a9ac2
commit 617b4bed41
1 changed files with 9 additions and 6 deletions

View File

@ -1,15 +1,18 @@
var originalTemplates, originalMobileViewFlag; var originalTemplates, originalMobileViewFlag;
var lookup = function(lookupString, expectedTemplate, message) { function lookup(lookupString, expectedTemplate, message) {
// {singleton: false} prevents Ember from caching lookup results (what would make them persistent across multiple tests, breaking test isolation) var container = Discourse.__container__;
equal(Discourse.__container__.lookup(lookupString, {singleton: false}), expectedTemplate, message); equal(container.lookup(lookupString), expectedTemplate, message);
};
var setTemplates = function(lookupStrings) { // Remove any cached results from the container
container.unregister(lookupString);
}
function setTemplates(lookupStrings) {
lookupStrings.forEach(function(lookupString) { lookupStrings.forEach(function(lookupString) {
Ember.TEMPLATES[lookupString] = lookupString; Ember.TEMPLATES[lookupString] = lookupString;
}); });
}; }
module("Discourse.Resolver", { module("Discourse.Resolver", {
setup: function() { setup: function() {