Fixing WinRM communicator unit test.

This commit is contained in:
Jeremy Roberts 2015-08-30 21:08:39 -04:00
parent 18d229ca82
commit 44154c92a9
1 changed files with 2 additions and 1 deletions

View File

@ -20,6 +20,7 @@ describe VagrantPlugins::CommunicatorWinRM::Communicator do
before do before do
allow(shell).to receive(:username).and_return('vagrant') allow(shell).to receive(:username).and_return('vagrant')
allow(shell).to receive(:password).and_return('password') allow(shell).to receive(:password).and_return('password')
allow(shell).to receive(:execution_time_limit).and_return('PT2H')
end end
describe ".ready?" do describe ".ready?" do
@ -56,7 +57,7 @@ describe VagrantPlugins::CommunicatorWinRM::Communicator do
expect(shell).to receive(:upload).with(kind_of(String), "c:/tmp/vagrant-elevated-shell.ps1") expect(shell).to receive(:upload).with(kind_of(String), "c:/tmp/vagrant-elevated-shell.ps1")
expect(shell).to receive(:powershell) do |cmd| expect(shell).to receive(:powershell) do |cmd|
expect(cmd).to eq("powershell -executionpolicy bypass -file \"c:/tmp/vagrant-elevated-shell.ps1\" " + expect(cmd).to eq("powershell -executionpolicy bypass -file \"c:/tmp/vagrant-elevated-shell.ps1\" " +
"-username \"vagrant\" -password \"password\" -encoded_command \"ZABpAHIAOwAgAGUAeABpAHQAIAAkAEwAQQBTAFQARQBYAEkAVABDAE8ARABFAA==\"") "-username \"vagrant\" -password \"password\" -encoded_command \"ZABpAHIAOwAgAGUAeABpAHQAIAAkAEwAQQBTAFQARQBYAEkAVABDAE8ARABFAA==\" -execution_time_limit \"PT2H\"")
end.and_return({ exitcode: 0 }) end.and_return({ exitcode: 0 })
expect(subject.execute("dir", { elevated: true })).to eq(0) expect(subject.execute("dir", { elevated: true })).to eq(0)
end end