2010-01-26 20:31:03 +00:00
|
|
|
require File.join(File.dirname(__FILE__), 'helper')
|
|
|
|
|
|
|
|
class TestSSH < Test::Unit::TestCase
|
|
|
|
context "an ssh connection" do
|
|
|
|
setup do
|
2010-01-27 20:42:53 +00:00
|
|
|
@ssh = Hydra::SSH.new(
|
|
|
|
'localhost', # connect to this machine
|
|
|
|
File.expand_path(File.join(File.dirname(__FILE__))), # move to the test directory
|
2010-01-28 15:23:42 +00:00
|
|
|
"ruby fixtures/echo_the_dolphin.rb"
|
2010-01-27 20:42:53 +00:00
|
|
|
)
|
|
|
|
@message = Hydra::Messages::TestMessage.new
|
2010-01-26 20:31:03 +00:00
|
|
|
end
|
2010-01-27 20:57:26 +00:00
|
|
|
teardown do
|
|
|
|
@ssh.close
|
|
|
|
end
|
2010-01-26 20:31:03 +00:00
|
|
|
should "be able to execute a command" do
|
2010-01-27 20:42:53 +00:00
|
|
|
@ssh.write @message
|
|
|
|
assert_equal @message.text, @ssh.gets.text
|
2010-01-26 20:31:03 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|