diff --git a/spec/config-spec.coffee b/spec/config-spec.coffee index 277a8a2d3..f3a3d6e79 100644 --- a/spec/config-spec.coffee +++ b/spec/config-spec.coffee @@ -32,7 +32,7 @@ describe "Config", -> config.set("foo.bar.baz", 42) expect(config.save).toHaveBeenCalled() - expect(observeHandler).toHaveBeenCalledWith 42 + expect(observeHandler).toHaveBeenCalledWith 42, {previous: undefined} describe "when the value equals the default value", -> it "does not store the value", -> @@ -54,7 +54,7 @@ describe "Config", -> expect(config.pushAtKeyPath("foo.bar.baz", "b")).toBe 2 expect(config.get("foo.bar.baz")).toEqual ["a", "b"] - expect(observeHandler).toHaveBeenCalledWith config.get("foo.bar.baz") + expect(observeHandler).toHaveBeenCalledWith config.get("foo.bar.baz"), {previous: ['a']} describe ".removeAtKeyPath(keyPath, value)", -> it "removes the given value from the array at the key path and updates observers", -> @@ -65,7 +65,7 @@ describe "Config", -> expect(config.removeAtKeyPath("foo.bar.baz", "b")).toEqual ["a", "c"] expect(config.get("foo.bar.baz")).toEqual ["a", "c"] - expect(observeHandler).toHaveBeenCalledWith config.get("foo.bar.baz") + expect(observeHandler).toHaveBeenCalledWith config.get("foo.bar.baz"), {previous: ['a', 'b', 'c']} describe ".getPositiveInt(keyPath, defaultValue)", -> it "returns the proper current or default value", -> @@ -142,26 +142,26 @@ describe "Config", -> it "fires the callback every time the observed value changes", -> observeHandler.reset() # clear the initial call config.set('foo.bar.baz', "value 2") - expect(observeHandler).toHaveBeenCalledWith("value 2") + expect(observeHandler).toHaveBeenCalledWith("value 2", {previous: 'value 1'}) observeHandler.reset() config.set('foo.bar.baz', "value 1") - expect(observeHandler).toHaveBeenCalledWith("value 1") + expect(observeHandler).toHaveBeenCalledWith("value 1", {previous: 'value 2'}) it "fires the callback when the observed value is deleted", -> observeHandler.reset() # clear the initial call config.set('foo.bar.baz', undefined) - expect(observeHandler).toHaveBeenCalledWith(undefined) + expect(observeHandler).toHaveBeenCalledWith(undefined, {previous: 'value 1'}) it "fires the callback when the full key path goes into and out of existence", -> observeHandler.reset() # clear the initial call config.set("foo.bar", undefined) - expect(observeHandler).toHaveBeenCalledWith(undefined) + expect(observeHandler).toHaveBeenCalledWith(undefined, {previous: 'value 1'}) observeHandler.reset() config.set("foo.bar.baz", "i'm back") - expect(observeHandler).toHaveBeenCalledWith("i'm back") + expect(observeHandler).toHaveBeenCalledWith("i'm back", {previous: undefined}) describe ".initializeConfigDirectory()", -> beforeEach ->