Which_test
This commit is contained in:
parent
f837d32ae4
commit
987b3008fe
|
@ -1,10 +1,9 @@
|
|||
require File.expand_path("../../../base", __FILE__)
|
||||
|
||||
require 'vagrant/util/file_util'
|
||||
require 'vagrant/util/platform'
|
||||
require 'vagrant/util/which'
|
||||
|
||||
describe Vagrant::Util::FileUtil do
|
||||
|
||||
describe Vagrant::Util::Which do
|
||||
def tester (file_extension, test_extension, mode, &block)
|
||||
# create file in temp directory
|
||||
filename = '__vagrant_unit_test__'
|
||||
|
@ -24,23 +23,21 @@ describe Vagrant::Util::FileUtil do
|
|||
|
||||
it "should return a path for an executable file" do
|
||||
tester '.bat', '.bat', 0755 do |name|
|
||||
Vagrant::Util::FileUtil.which(name).should_not be_nil
|
||||
described_class.which(name).should_not be_nil
|
||||
end
|
||||
end
|
||||
|
||||
if Vagrant::Util::Platform.windows?
|
||||
it "should return a path for a Windows executable file" do
|
||||
tester '.bat', '', 0755 do |name|
|
||||
Vagrant::Util::FileUtil.which(name).should_not be_nil
|
||||
described_class.which(name).should_not be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it "should return nil for a non-executable file" do
|
||||
tester '.txt', '.txt', 0644 do |name|
|
||||
Vagrant::Util::FileUtil.which(name).should be_nil
|
||||
described_class.which(name).should be_nil
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue