Get unit tests passing again

This commit is contained in:
Mitchell Hashimoto 2011-11-25 23:55:17 -07:00
parent 8bb6d375f1
commit 1155983307
1 changed files with 4 additions and 7 deletions

View File

@ -9,6 +9,7 @@ class SshTest < Test::Unit::TestCase
@env.vm.stubs(:vm).returns(@vm) @env.vm.stubs(:vm).returns(@vm)
@ssh = Vagrant::SSH.new(@env) @ssh = Vagrant::SSH.new(@env)
@session = mock("session")
end end
setup do setup do
@ -177,11 +178,7 @@ class SshTest < Test::Unit::TestCase
mock_ssh mock_ssh
@ssh.stubs(:check_key_permissions) @ssh.stubs(:check_key_permissions)
@ssh.stubs(:port).returns(2222) @ssh.stubs(:port).returns(2222)
end @session.stubs(:exec!).returns("hello\n")
should "return true if SSH connection works" do
Net::SSH.expects(:start).yields("success")
assert @ssh.up?
end end
should "return false if SSH connection times out" do should "return false if SSH connection times out" do
@ -203,8 +200,8 @@ class SshTest < Test::Unit::TestCase
} }
end end
should "specifity the timeout as an option to execute" do should "specify the timeout as an option to execute" do
@ssh.expects(:execute).yields(true).with() do |opts| @ssh.expects(:execute).yields(@session).with() do |opts|
assert_equal @env.config.ssh.timeout, opts[:timeout] assert_equal @env.config.ssh.timeout, opts[:timeout]
true true
end end