Add test coverage for powershell module option
This commit is contained in:
parent
42cbae1e90
commit
bf7cd4fb0a
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue