Add spec for existing value conforming to new schema

Esse commit está contido em:
Kevin Sawicki
2015-01-22 16:14:30 -08:00
commit 74358f3e79
2 arquivos alterados com 9 adições e 5 exclusões
+5 -4
Ver Arquivo
@@ -1108,12 +1108,13 @@ describe "Config", ->
it "validates any values set before the schema was set", ->
atom.config.set('foo.bar.anInt', 'integer')
schema =
type: 'integer'
default: 12
atom.config.setSchema('foo.bar.anInt', schema)
atom.config.setSchema('foo.bar.anInt', {type: 'integer', default: 12})
expect(atom.config.get("foo.bar.anInt")).toBe 12
atom.config.set('foo.bar.aString', 'foo')
atom.config.setSchema('foo.bar.aString', {type: 'string', default: 'bar'})
expect(atom.config.get("foo.bar.aString")).toBe 'foo'
describe 'when the value has an "integer" type', ->
beforeEach ->
schema =
+4 -1
Ver Arquivo
@@ -801,7 +801,10 @@ class Config
if keyPath
value = @get(keyPath)
unless value is undefined
@unset(keyPath) unless @set(keyPath, value)
try
@makeValueConformToSchema(keyPath, value)
catch error
@unset(keyPath)
return