Add tests

This commit is contained in:
Jeff Bonhag 2019-11-05 14:39:08 -05:00
parent 2f649c1732
commit 59901bd9fc
1 changed files with 36 additions and 0 deletions

View File

@ -337,4 +337,40 @@ EOH
end
end
end
describe ".modinfo_path" do
let(:cap){ VagrantPlugins::HostLinux::Cap::NFS }
context "with modinfo on PATH" do
before do
expect(Vagrant::Util::Which).to receive(:which).with("modinfo").and_return("/usr/bin/modinfo")
end
it "should use full path to modinfo" do
expect(cap.modinfo_path).to eq("/usr/bin/modinfo")
end
end
context "with modinfo at /sbin/modinfo" do
before do
expect(Vagrant::Util::Which).to receive(:which).with("modinfo").and_return(nil)
expect(File).to receive(:file?).with("/sbin/modinfo").and_return(true)
end
it "should use /sbin/modinfo" do
expect(cap.modinfo_path).to eq("/sbin/modinfo")
end
end
context "modinfo not found" do
before do
expect(Vagrant::Util::Which).to receive(:which).with("modinfo").and_return(nil)
expect(File).to receive(:file?).with("/sbin/modinfo").and_return(false)
end
it "should use modinfo" do
expect(cap.modinfo_path).to eq("modinfo")
end
end
end
end