Use ‘source’ option rather than internal state in Config spec

This commit is contained in:
Nathan Sobo 2014-12-12 09:16:12 -07:00 committed by Max Brunsfeld
parent c35fb90653
commit d30cf35a16

View File

@ -75,7 +75,7 @@ describe "Config", ->
expect(observeHandler).toHaveBeenCalledWith 42 expect(observeHandler).toHaveBeenCalledWith 42
describe "when the value equals the default value", -> describe "when the value equals the default value", ->
it "does not store the value", -> it "does not store the value in the user's config", ->
atom.config.setDefaults "foo", atom.config.setDefaults "foo",
same: 1 same: 1
changes: 1 changes: 1
@ -91,10 +91,12 @@ describe "Config", ->
atom.config.set('foo.null', undefined) atom.config.set('foo.null', undefined)
atom.config.set('foo.undefined', null) atom.config.set('foo.undefined', null)
atom.config.set('foo.sameObject', {b: 2, a: 1}) atom.config.set('foo.sameObject', {b: 2, a: 1})
expect(atom.config.settings.foo).toEqual {changes: 2}
expect(atom.config.get("foo.same", sources: [atom.config.getUserConfigPath()])).toBeUndefined()
expect(atom.config.get("foo.changes", sources: [atom.config.getUserConfigPath()])).toBe 2
atom.config.set('foo.changes', 1) atom.config.set('foo.changes', 1)
expect(atom.config.settings.foo).toEqual {} expect(atom.config.get("foo.changes", sources: [atom.config.getUserConfigPath()])).toBeUndefined()
describe ".getDefault(keyPath)", -> describe ".getDefault(keyPath)", ->
it "returns a clone of the default value", -> it "returns a clone of the default value", ->