Add test for WinRMNotReady exceptions for ready? method
This commit is contained in:
parent
796ff7b190
commit
d2b7da065f
|
@ -13,7 +13,7 @@ describe VagrantPlugins::CommunicatorWinRM::Communicator do
|
|||
let(:shell) { double("shell") }
|
||||
let(:good_output) { WinRM::Output.new.tap { |out| out.exitcode = 0 } }
|
||||
let(:bad_output) { WinRM::Output.new.tap { |out| out.exitcode = 1 } }
|
||||
|
||||
|
||||
subject do
|
||||
described_class.new(machine).tap do |comm|
|
||||
allow(comm).to receive(:create_shell).and_return(shell)
|
||||
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue