SSH.up? returns false when an abrupt disconnect occurs

This commit is contained in:
Mitchell Hashimoto 2010-02-16 16:05:58 -08:00
parent e855ae9965
commit 8d9e53fe27
2 changed files with 8 additions and 1 deletions

View File

@ -31,7 +31,7 @@ module Vagrant
end
false
rescue Errno::ECONNREFUSED
rescue Errno::ECONNREFUSED, Net::SSH::Disconnect
false
end

View File

@ -74,6 +74,13 @@ class SshTest < Test::Unit::TestCase
assert !Vagrant::SSH.up?
}
end
should "return false if the connection is dropped" do
Net::SSH.expects(:start).raises(Net::SSH::Disconnect)
assert_nothing_raised {
assert !Vagrant::SSH.up?
}
end
end
context "getting the ssh port" do