Added test to ensure comm test method checks stderr
This commit is contained in:
parent
c4422d7c70
commit
f7a344fe95
|
@ -75,15 +75,23 @@ describe VagrantPlugins::CommunicatorWinRM::Communicator do
|
|||
|
||||
describe ".test" do
|
||||
it "returns true when exit code is zero" do
|
||||
expect(shell).to receive(:powershell).with(kind_of(String)).and_return({ exitcode: 0 })
|
||||
output = { exitcode: 0, data:[{ stderr: '' }] }
|
||||
expect(shell).to receive(:powershell).with(kind_of(String)).and_return(output)
|
||||
expect(subject.test("test -d c:/windows")).to be_true
|
||||
end
|
||||
|
||||
it "returns false when exit code is non-zero" do
|
||||
expect(shell).to receive(:powershell).with(kind_of(String)).and_return({ exitcode: 1 })
|
||||
output = { exitcode: 1, data:[{ stderr: '' }] }
|
||||
expect(shell).to receive(:powershell).with(kind_of(String)).and_return(output)
|
||||
expect(subject.test("test -d /tmp/foobar")).to be_false
|
||||
end
|
||||
|
||||
it "returns false when stderr contains output" do
|
||||
output = { exitcode: 0, data:[{ stderr: 'this is an error' }] }
|
||||
expect(shell).to receive(:powershell).with(kind_of(String)).and_return(output)
|
||||
expect(subject.test("[-x stuff] && foo")).to be_false
|
||||
end
|
||||
|
||||
it "returns false when command is testing for linux OS" do
|
||||
expect(subject.test("uname -s | grep Debian")).to be_false
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue