test/unit/test_host.rb in sshkit-1.7.1 vs test/unit/test_host.rb in sshkit-1.8.0
- old
+ new
@@ -1,7 +1,6 @@
require 'helper'
-require 'etc'
module SSHKit
class TestHost < UnitTest
@@ -44,12 +43,13 @@
def test_host_local
h = Host.new :local
assert h.local?
assert_nil h.port
- assert_equal Etc.getpwuid.name, h.username
- assert_equal 'localhost', h.hostname
+ username_candidates = ENV['USER'] || ENV['LOGNAME'] || ENV['USERNAME']
+ assert_equal username_candidates, h.username
+ assert_equal 'localhost', h.hostname
end
def test_does_not_confuse_ipv6_hosts_with_port_specification
h = Host.new '[1fff:0:a88:85a3::ac1f]:8001'
assert_equal 8001, h.port
@@ -63,10 +63,9 @@
def test_assert_hosts_hash_equally
assert_equal Host.new('example.com').hash, Host.new('example.com').hash
end
def test_assert_hosts_compare_equal
- assert Host.new('example.com') == Host.new('example.com')
assert Host.new('example.com').eql? Host.new('example.com')
assert Host.new('example.com').equal? Host.new('example.com')
end
def test_arbitrary_host_properties