test/executioner_test.rb in executioner-0.2.0 vs test/executioner_test.rb in executioner-0.3.0

- old
+ new

@@ -158,22 +158,25 @@ @object.expects(:execute).with { |command, options| options[:env] == { :foo => 'foo' } } @object.with_env 'arg1', :env => { :foo => 'foo' } 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 it "should be possible to find an executable advancing from a given path" do File.stubs(:exist?).with('/usr/bin/sh').returns(true) Executioner::ClassMethods.find_executable('sh', '/bin').should == '/usr/bin/sh' 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 }) lambda { @object.with_selection_proc('foo') }.should.raise Executioner::ExecutableNotFoundError \ No newline at end of file