mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Make sure showing errors works correctly
This commit is contained in:
@@ -20,10 +20,32 @@ describe "CommandInstaller on #darwin", ->
|
||||
spyOn(CommandInstaller::, 'getResourcesDirectory').andReturn(resourcesPath)
|
||||
spyOn(CommandInstaller::, 'getInstallDirectory').andReturn(installationPath)
|
||||
|
||||
it "shows an error dialog when installing commands interactively fails", ->
|
||||
appDelegate = jasmine.createSpyObj("appDelegate", ["confirm"])
|
||||
installer = new CommandInstaller("2.0.2", appDelegate)
|
||||
spyOn(installer, "installAtomCommand").andCallFake (__, callback) -> callback(new Error("an error"))
|
||||
|
||||
installer.installShellCommandsInteractively()
|
||||
|
||||
expect(appDelegate.confirm).toHaveBeenCalledWith({
|
||||
message: "Failed to install shell commands"
|
||||
detailedMessage: "an error"
|
||||
})
|
||||
|
||||
appDelegate.confirm.reset()
|
||||
installer.installAtomCommand.andCallFake (__, callback) -> callback()
|
||||
spyOn(installer, "installApmCommand").andCallFake (__, callback) -> callback(new Error("another error"))
|
||||
|
||||
installer.installShellCommandsInteractively()
|
||||
|
||||
expect(appDelegate.confirm).toHaveBeenCalledWith({
|
||||
message: "Failed to install shell commands"
|
||||
detailedMessage: "another error"
|
||||
})
|
||||
|
||||
describe "when using a stable version of atom", ->
|
||||
beforeEach ->
|
||||
confirm = ->
|
||||
installer = new CommandInstaller("2.0.2", confirm)
|
||||
installer = new CommandInstaller("2.0.2")
|
||||
|
||||
it "symlinks the atom command as 'atom'", ->
|
||||
installedAtomPath = path.join(installationPath, 'atom')
|
||||
|
||||
@@ -35,7 +35,7 @@ class CommandInstaller
|
||||
process.resourcesPath
|
||||
|
||||
installShellCommandsInteractively: ->
|
||||
showErrorDialog = (error) ->
|
||||
showErrorDialog = (error) =>
|
||||
@applicationDelegate.confirm
|
||||
message: "Failed to install shell commands"
|
||||
detailedMessage: error.message
|
||||
|
||||
Reference in New Issue
Block a user