Clean up powershell tests and add test for full path check

This commit is contained in:
Chris Roberts 2018-06-18 09:39:17 -07:00
parent fe8fe55d1f
commit cdab45424e
1 changed files with 9 additions and 2 deletions

View File

@ -63,7 +63,10 @@ describe Vagrant::Util::PowerShell do
end
context "when within WSL" do
before{ expect(Vagrant::Util::Platform).to receive(:wsl?).and_return(true) }
before do
allow(Vagrant::Util::Which).to receive(:which).with(/powershell/).and_return(nil)
expect(Vagrant::Util::Platform).to receive(:wsl?).and_return(true)
end
it "should check PATH with .exe extension" do
expect(Vagrant::Util::Which).to receive(:which).with("powershell.exe")
@ -76,9 +79,13 @@ describe Vagrant::Util::PowerShell do
end
it "should return nil when not found" do
expect(Vagrant::Util::Which).to receive(:which).with("powershell.exe").and_return(nil)
expect(described_class.executable).to be_nil
end
it "should check for powershell with full path" do
expect(Vagrant::Util::Which).to receive(:which).with(/Windows\/System32.+powershell.exe/)
described_class.executable
end
end
end
end