require File.dirname(__FILE__) + '/test_helper' class AstrovanTest < Test::Unit::TestCase def test_using_should_require_block assert_raise ArgumentError do using 'one.astrovan.local' end end def test_using_should_require_at_least_one_host assert_raise ArgumentError do using do end end end def test_using_should_setup_session_for_specified_host assert_nothing_raised do using 'one.astrovan.local' do raise StandardError if hosts != %w(one.astrovan.local) end end end def test_using_should_setup_session_for_multiple_hosts assert_nothing_raised do using 'one.astrovan.local', 'two.astrovan.local', 'three.astrovan.local' do raise StandardError if hosts != %w(one.astrovan.local two.astrovan.local three.astrovan.local) end end end def test_using_should_setup_session_for_array_of_hosts assert_nothing_raised do using %w(one.astrovan.local two.astrovan.local three.astrovan.local) do raise StandardError if hosts != %w(one.astrovan.local two.astrovan.local three.astrovan.local) end end end def test_using_should_setup_session_for_mixed_host_arguments assert_nothing_raised do using %w(one.astrovan.local two.astrovan.local), 'three.astrovan.local' do raise StandardError if hosts != %w(one.astrovan.local two.astrovan.local three.astrovan.local) end end end def test_using_should_create_session assert_nothing_raised do using %w(one.astrovan.local two.astrovan.local) do raise TypeError unless session.is_a?(Net::SSH::Multi::Session) raise StandardError if servers.size != hosts.size end end end def test_using_should_create_subsession assert_nothing_raised do using %w(one.astrovan.local two.astrovan.local) do session = session_for(%w(one.astrovan.local)) raise TypeError unless session.is_a?(Net::SSH::Multi::Subsession) raise StandardError if servers.size != hosts.size end end end end