Throw when Config::set is called w/ source and no scope

This commit is contained in:
Max Brunsfeld 2014-12-16 09:52:56 -08:00
parent 2cea51b50e
commit ab89776f01
2 changed files with 6 additions and 0 deletions

View File

@ -77,6 +77,9 @@ describe "Config", ->
expect(atom.config.save).toHaveBeenCalled()
expect(observeHandler).toHaveBeenCalledWith 42
it "does not allow a 'source' option without a 'scopeSelector'", ->
expect(-> atom.config.set("foo", 1, source: [".source.ruby"])).toThrow()
describe "when the value equals the default value", ->
it "does not store the value in the user's config", ->
atom.config.setDefaults "foo",

View File

@ -541,6 +541,9 @@ class Config
scopeSelector = options?.scopeSelector
source = options?.source
if source and not scopeSelector
throw new Error("::set with a 'source' and no 'sourceSelector' is not yet implemented!")
source ?= @getUserConfigPath()
unless value is undefined