diff --git a/test/unit/vagrant/util/powershell_test.rb b/test/unit/vagrant/util/powershell_test.rb index ce30bd4d1..0733f7783 100644 --- a/test/unit/vagrant/util/powershell_test.rb +++ b/test/unit/vagrant/util/powershell_test.rb @@ -135,6 +135,14 @@ describe Vagrant::Util::PowerShell do end described_class.execute("custom-command", env: {"TEST_KEY" => "test-value"}) end + + it "should define a custom module path" do + expect(Vagrant::Util::Subprocess).to receive(:execute) do |*args| + comm = args.detect{|s| s.to_s.include?("custom-command") } + expect(comm.to_s).to include("$env:PSModulePath+';C:\\My-Path'") + end + described_class.execute("custom-command", module_path: "C:\\My-Path") + end end describe ".execute_cmd" do @@ -183,6 +191,15 @@ describe Vagrant::Util::PowerShell do described_class.execute_cmd("custom-command", env: {"TEST_KEY" => "test-value"}) end + it "should define a custom module path" do + expect(Vagrant::Util::Subprocess).to receive(:execute) do |*args| + comm = args.detect{|s| s.to_s.include?("custom-command") } + expect(comm.to_s).to include("$env:PSModulePath+';C:\\My-Path'") + result + end + described_class.execute_cmd("custom-command", module_path: "C:\\My-Path") + end + context "with command output" do let(:stdout){ "custom-output" } @@ -246,6 +263,15 @@ describe Vagrant::Util::PowerShell do described_class.execute_inline("custom-command", env: {"TEST_KEY" => "test-value"}) end + it "should define a custom module path" do + expect(Vagrant::Util::Subprocess).to receive(:execute) do |*args| + comm = args.detect{|s| s.to_s.include?("custom-command") } + expect(comm.to_s).to include("$env:PSModulePath+';C:\\My-Path'") + result + end + described_class.execute_inline("custom-command", module_path: "C:\\My-Path") + end + it "should return a result instance" do expect(described_class.execute_inline("cmd")).to eq(result) end