diff --git a/test/unit/plugins/communicators/winrm/communicator_test.rb b/test/unit/plugins/communicators/winrm/communicator_test.rb index ae5cbc7bb..268e7c48c 100644 --- a/test/unit/plugins/communicators/winrm/communicator_test.rb +++ b/test/unit/plugins/communicators/winrm/communicator_test.rb @@ -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)