pulsar/spec/command-installer-spec.coffee

35 lines
1.2 KiB
CoffeeScript
Raw Normal View History

2013-10-21 18:23:22 +04:00
path = require 'path'
2014-02-24 05:19:00 +04:00
fs = require 'fs-plus'
temp = require 'temp'
2013-09-18 05:58:41 +04:00
installer = require '../src/command-installer'
describe "install(commandPath, callback)", ->
2014-01-23 01:35:07 +04:00
commandFilePath = temp.openSync("atom-command").path
commandName = path.basename(commandFilePath)
2014-01-23 03:54:49 +04:00
installationPath = temp.mkdirSync("atom-bin")
installationFilePath = path.join(installationPath, commandName)
beforeEach ->
2014-02-15 05:53:31 +04:00
fs.chmodSync(commandFilePath, '755')
2014-01-23 03:54:49 +04:00
spyOn(installer, 'getInstallDirectory').andReturn installationPath
2013-11-06 04:44:03 +04:00
describe "on #darwin", ->
it "symlinks the command and makes it executable", ->
2014-01-23 01:35:07 +04:00
expect(fs.isFileSync(commandFilePath)).toBeTruthy()
2014-01-23 03:54:49 +04:00
expect(fs.isFileSync(installationFilePath)).toBeFalsy()
2013-11-06 04:44:03 +04:00
installDone = false
installError = null
2014-02-13 22:08:08 +04:00
installer.install commandFilePath, false, (error) ->
2013-11-06 04:44:03 +04:00
installDone = true
installError = error
2014-01-23 01:35:07 +04:00
waitsFor ->
installDone
2013-11-06 04:44:03 +04:00
runs ->
expect(installError).toBeNull()
2014-01-23 03:54:49 +04:00
expect(fs.isFileSync(installationFilePath)).toBeTruthy()
expect(fs.realpathSync(installationFilePath)).toBe fs.realpathSync(commandFilePath)
expect(fs.isExecutableSync(installationFilePath)).toBeTruthy()