Add test for WinRMNotReady exceptions for ready? method

This commit is contained in:
Brian Cain 2018-11-05 14:14:50 -08:00
parent 796ff7b190
commit d2b7da065f
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
1 changed files with 6 additions and 1 deletions

View File

@ -68,6 +68,11 @@ describe VagrantPlugins::CommunicatorWinRM::Communicator do
expect(subject.ready?).to be(false)
end
it "returns false if hostname command fails with a WinRMNotReady error" do
expect(shell).to receive(:cmd).with("hostname").and_raise(VagrantPlugins::CommunicatorWinRM::Errors::WinRMNotReady)
expect(subject.ready?).to be(false)
end
it "raises an error if hostname command fails with an unknown error" do
expect(shell).to receive(:cmd).with("hostname").and_raise(Vagrant::Errors::VagrantError)
expect { subject.ready? }.to raise_error(Vagrant::Errors::VagrantError)