From 835c500892f339403c4579dedc9b386e87b4c410 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Mon, 18 Jun 2018 09:50:56 -0700 Subject: [PATCH] Add WSL check on usable? test for provider --- test/unit/plugins/providers/hyperv/provider_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/unit/plugins/providers/hyperv/provider_test.rb b/test/unit/plugins/providers/hyperv/provider_test.rb index bac4512e6..98e9c7d96 100644 --- a/test/unit/plugins/providers/hyperv/provider_test.rb +++ b/test/unit/plugins/providers/hyperv/provider_test.rb @@ -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)