From 5a70276201ccc3c713f6c5529acede3070bb980d Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 21 Jan 2014 18:09:53 -0800 Subject: [PATCH] Fix specs --- spec/command-installer-spec.coffee | 4 +--- src/command-installer.coffee | 5 ++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/spec/command-installer-spec.coffee b/spec/command-installer-spec.coffee index c6b8ee321..679a9b5df 100644 --- a/spec/command-installer-spec.coffee +++ b/spec/command-installer-spec.coffee @@ -9,9 +9,7 @@ describe "install(commandPath, callback)", -> destinationPath = path.join(directory, 'bin', 'source') beforeEach -> - spyOn(installer, 'findInstallDirectory').andCallFake (callback) -> - callback(directory) - + spyOn(installer, 'getInstallDirectory').andReturn directory fs.removeSync(directory) if fs.existsSync(directory) describe "on #darwin", -> diff --git a/src/command-installer.coffee b/src/command-installer.coffee index 622e3a249..a41b8cc15 100644 --- a/src/command-installer.coffee +++ b/src/command-installer.coffee @@ -23,6 +23,9 @@ unlinkCommand = (destinationPath, callback) -> callback() module.exports = + getInstallDirectory: -> + "/usr/local" + install: (commandPath, commandName, callback) -> if not commandName? or _.isFunction(commandName) callback = commandName @@ -33,7 +36,7 @@ module.exports = console.warn "Failed to install `#{commandName}` binary", error callback?(error, sourcePath, destinationPath) - directory = "/usr/local" + directory = @getInstallDirectory() if fs.existsSync(directory) destinationPath = path.join(directory, 'bin', commandName) unlinkCommand destinationPath, (error) ->