Permalink
Browse files

Added ~/bin to search paths and made tests green.

  • Loading branch information...
1 parent abc071a commit 60c307d9bdaafb2995ac3ad07d8cd8444e9e49e3 @alloy alloy committed Dec 9, 2009
Showing with 5 additions and 1 deletion.
  1. +1 −0 .kick
  2. +1 −1 lib/executioner.rb
  3. +3 −0 test/executioner_test.rb
View
1 .kick
@@ -0,0 +1 @@
+recipe :ruby
View
@@ -5,7 +5,7 @@ class ExecutionerError < StandardError; end
class ProcessError < ExecutionerError; end
class ExecutableNotFoundError < ExecutionerError; end
- SEARCH_PATHS = %w{ /bin /usr/bin /usr/local/bin /opt/homebrew/bin /opt/local/bin }
+ SEARCH_PATHS = %W{ #{File.expand_path('~/bin')} /bin /usr/bin /usr/local/bin /opt/homebrew/bin /opt/local/bin }
class << self
attr_accessor :logger
View
@@ -160,6 +160,7 @@ def stub_popen3(stdout = '', stderr = '')
end
it "should be possible to find an executable" do
+ File.stubs(:exist?).with(File.expand_path('~/bin/sh')).returns(false)
File.stubs(:exist?).with('/bin/sh').returns(true)
Executioner::ClassMethods.find_executable('sh').should == '/bin/sh'
end
@@ -170,9 +171,11 @@ def stub_popen3(stdout = '', stderr = '')
end
it "should yield all found executables, but use the one for which the proc returns a truthful value" do
+ File.stubs(:exist?).with(File.expand_path('~/bin/with_selection_proc')).returns(true)
File.stubs(:exist?).with('/bin/with_selection_proc').returns(true)
File.stubs(:exist?).with('/usr/bin/with_selection_proc').returns(true)
File.stubs(:exist?).with('/usr/local/bin/with_selection_proc').returns(true)
+ File.stubs(:exist?).with('/opt/homebrew/bin/with_selection_proc').returns(true)
File.stubs(:exist?).with('/opt/local/bin/with_selection_proc').returns(true)
AClassThatUsesSubshells.executable(:with_selection_proc, :select_if => lambda { |executable| nil })

0 comments on commit 60c307d

Please sign in to comment.