From fbdd99c60c9a77e55e8112435c0ea9dc5e777a4b Mon Sep 17 00:00:00 2001 From: Johan Holmberg Date: Sun, 19 Apr 2009 16:39:02 +0000 Subject: [PATCH] New method "prepend_local_path", to be able to add a directory inside the workdir to the PATH. --- lib/cmdtest/testcase.rb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/cmdtest/testcase.rb b/lib/cmdtest/testcase.rb index 6d98f4b..29f1763 100644 --- a/lib/cmdtest/testcase.rb +++ b/lib/cmdtest/testcase.rb @@ -115,7 +115,7 @@ module Cmdtest end #------------------------------ - # Dont count the specified file when calculating the "side effects" + # Don't count the specified file when calculating the "side effects" # of a command. def ignore_file(file) @@ -123,7 +123,7 @@ module Cmdtest end #------------------------------ - # Dont count the specified file when calculating the "side effects" + # Don't count the specified file when calculating the "side effects" # of a command. def ignore_files(*files) @@ -134,11 +134,20 @@ module Cmdtest #------------------------------ # Prepend the given directory to the PATH before running commands. - # The path is evaluated realtive to the current directory when 'cmdtest' + # The path is evaluated relative to the current directory when 'cmdtest' # was started. def prepend_path(dir) - @_prepend_path_dirs.unshift(dir) + @_prepend_path_dirs.unshift(File.expand_path(dir, @_runner.orig_cwd)) + end + + #------------------------------ + # Prepend the given directory to the PATH before running commands. + # The path is evaluated relative to the current directory at the time + # of the call was started. + + def prepend_local_path(dir) + @_prepend_path_dirs.unshift(File.expand_path(dir, Dir.pwd)) end #==============================