       atom.config.configDirPath = dotAtomPath
       atom.config.configFilePath = path.join(atom.config.configDirPath, "atom.config.cson")
       expect(fs.existsSync(atom.config.configDirPath)).toBeFalsy()
+      atom.config.setSchema 'foo',
+        type: 'object'
+        properties:
+          bar:
+            type: 'string'
+            default: 'def'
+          int:
+            type: 'integer'
+            default: 12
 
     afterEach ->
       fs.removeSync(dotAtomPath)

        it "does not fire a change event for paths that did not change", ->
          atom.config.onDidChange 'foo.bar', noChangeSpy = jasmine.createSpy()

          fs.writeFileSync(atom.config.configFilePath, "foo: { bar: ['baz', 'ok'], omg: 'another'}")
          waitsFor 'update event', -> updatedHandler.callCount > 0
          runs ->
            expect(noChangeSpy).not.toHaveBeenCalled()
            expect(atom.config.get('foo.bar')).toEqual ['baz', 'ok']
            expect(atom.config.get('foo.omg')).toBe 'another'

      describe 'when scoped settings are used', ->
        it "fires a change event for scoped settings that are removed", ->

        expect(fs.existsSync(atom.config.configFilePath)).toBe true
        expect(CSON.readFileSync(atom.config.configFilePath)).toEqual {}

    describe "when the config file contains values that do not adhere to the schema", ->
      warnSpy = null
      beforeEach ->
        warnSpy = spyOn console, 'warn'
        fs.writeFileSync atom.config.configFilePath, """
          foo:
            bar: 'baz'
            int: 'bad value'
        """
        atom.config.loadUserConfig()

      it "updates the only the settings that have values matching the schema", ->
        expect(atom.config.get("foo.bar")).toBe 'baz'
        expect(atom.config.get("foo.int")).toBe 12

        expect(warnSpy).toHaveBeenCalled()
        expect(warnSpy.mostRecentCall.args[0]).toContain "foo.int"

  describe ".observeUserConfig()", ->
    updatedHandler = null

    beforeEach ->
      atom.config.setSchema 'foo',
        type: 'object'
        properties:
          bar:
            type: 'string'
            default: 'def'
          baz:
            type: 'string'
          scoped:
            type: 'boolean'
          int:
            type: 'integer'
            default: 12

      atom.config.configDirPath = dotAtomPath
      atom.config.configFilePath = path.join(atom.config.configDirPath, "atom.config.cson")
      expect(fs.existsSync(atom.config.configDirPath)).toBeFalsy()
