From 489c552dbe1c14842379a7600eeb195f6d52950c Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 3 Oct 2014 15:05:37 +0100 Subject: [PATCH] Reset settings between tests --- red/settings.js | 8 +++++++- test/red/settings_spec.js | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/red/settings.js b/red/settings.js index 4921e7c4d..4994953f1 100644 --- a/red/settings.js +++ b/red/settings.js @@ -60,8 +60,8 @@ var persistentSettings = { if (globalSettings === null) { throw new Error("Settings not available"); } + var current = globalSettings[prop]; globalSettings[prop] = value; - var current = persistentSettings.get(prop); try { assert.deepEqual(current,value); return when.resolve(); @@ -72,6 +72,12 @@ var persistentSettings = { available: function() { return (globalSettings !== null); + }, + + reset: function() { + userSettings = null; + globalSettings = null; + storage = null; } } diff --git a/test/red/settings_spec.js b/test/red/settings_spec.js index 40553ab19..fb4cbade6 100644 --- a/test/red/settings_spec.js +++ b/test/red/settings_spec.js @@ -20,6 +20,11 @@ var settings = require("../../red/settings"); describe("red/settings", function() { + + afterEach(function() { + settings.reset(); + }); + it('wraps the user settings as read-only properties', function() { var userSettings = { a: 123,