vagrant/test/hobo/ssh_test.rb

25 lines
783 B
Ruby
Raw Normal View History

2010-01-26 08:01:17 +00:00
require File.join(File.dirname(__FILE__), '..', 'test_helper')
class SshTest < Test::Unit::TestCase
context "Hobo ssh" do
setup do
@handler = Hobo::SSH
@script = Hobo::SSH::SCRIPT
2010-01-30 06:39:45 +00:00
Hobo.config!(hobo_mock_config)
2010-01-26 08:01:17 +00:00
end
test "should call exec with defaults when no options are supplied" do
ssh = hobo_mock_config[:ssh]
Kernel.expects(:exec).with("#{@script} #{ssh[:uname]} #{ssh[:pass]} #{ssh[:host]} #{ssh[:port]}")
2010-01-26 08:01:17 +00:00
Hobo::SSH.connect
end
test "should call exec with supplied params" do
args = {:uname => 'bar', :pass => 'baz', :host => 'bak', :port => 'bag'}
Kernel.expects(:exec).with("#{@script} #{args[:uname]} #{args[:pass]} #{args[:host]} #{args[:port]}")
2010-01-26 08:01:17 +00:00
Hobo::SSH.connect(args)
end
end
end