Add WSL check on usable? test for provider

This commit is contained in:
Chris Roberts 2018-06-18 09:50:56 -07:00
parent c5c63d291d
commit 835c500892
1 changed files with 7 additions and 0 deletions

View File

@ -14,6 +14,7 @@ describe VagrantPlugins::HyperV::Provider do
stub_const("Vagrant::Util::PowerShell", powershell)
allow(machine).to receive(:id).and_return("foo")
allow(platform).to receive(:windows?).and_return(true)
allow(platform).to receive(:wsl?).and_return(false)
allow(platform).to receive(:windows_admin?).and_return(true)
allow(platform).to receive(:windows_hyperv_admin?).and_return(true)
allow(powershell).to receive(:available?).and_return(true)
@ -27,6 +28,12 @@ describe VagrantPlugins::HyperV::Provider do
expect(subject).to_not be_usable
end
it "returns true if within WSL" do
expect(platform).to receive(:windows?).and_return(false)
expect(platform).to receive(:wsl?).and_return(true)
expect(subject).to be_usable
end
it "returns false if neither an admin nor a hyper-v admin" do
allow(platform).to receive(:windows_admin?).and_return(false)
allow(platform).to receive(:windows_hyperv_admin?).and_return(false)