This commit is contained in:
Nathan Sobo
2013-04-08 20:00:55 -06:00
committed by Corey Johnson & Kevin Sawicki
parent 0e3f9297fb
commit 9fe264ded4

View File

@@ -110,7 +110,7 @@ describe "Config", ->
config.set("foo.bar.baz", "i'm back")
expect(observeHandler).toHaveBeenCalledWith("i'm back")
describe "initializeConfigDirectory()", ->
describe ".initializeConfigDirectory()", ->
beforeEach ->
config.configDirPath = '/tmp/dot-atom-dir'
expect(fsUtils.exists(config.configDirPath)).toBeFalsy()
@@ -148,20 +148,21 @@ describe "Config", ->
expect(fsUtils.isFile(fsUtils.join(config.configDirPath, 'themes/atom-dark-syntax.css'))).toBeTruthy()
expect(fsUtils.isFile(fsUtils.join(config.configDirPath, 'themes/atom-light-syntax.css'))).toBeTruthy()
describe "when the config file is not parseable", ->
beforeEach ->
config.configDirPath = '/tmp/dot-atom-dir'
config.configFilePath = fsUtils.join(config.configDirPath, "config.cson")
expect(fsUtils.exists(config.configDirPath)).toBeFalsy()
describe ".loadUserConfig()", ->
describe "when the config file cannot be parsed", ->
beforeEach ->
config.configDirPath = '/tmp/dot-atom-dir'
config.configFilePath = fsUtils.join(config.configDirPath, "config.cson")
expect(fsUtils.exists(config.configDirPath)).toBeFalsy()
afterEach ->
fsUtils.remove('/tmp/dot-atom-dir') if fsUtils.exists('/tmp/dot-atom-dir')
afterEach ->
fsUtils.remove('/tmp/dot-atom-dir') if fsUtils.exists('/tmp/dot-atom-dir')
it "logs an error to the console and does not overwrite the config file", ->
config.save.reset()
spyOn(console, 'error')
fsUtils.write(config.configFilePath, "{{{{{")
config.loadUserConfig()
config.set("hair", "blonde") # trigger a save
expect(console.error).toHaveBeenCalled()
expect(config.save).not.toHaveBeenCalled()
it "logs an error to the console and does not overwrite the config file", ->
config.save.reset()
spyOn(console, 'error')
fsUtils.write(config.configFilePath, "{{{{{")
config.loadUserConfig()
config.set("hair", "blonde") # trigger a save
expect(console.error).toHaveBeenCalled()
expect(config.save).not.toHaveBeenCalled()