Module: Socket::Etest

Defined in:
lib/vex/base/net/socket_ext.rb

Instance Method Summary collapse

Instance Method Details

#test_returns_127_locallyObject



36
37
38
39
40
41
42
# File 'lib/vex/base/net/socket_ext.rb', line 36

def test_returns_127_locally
  require 'ipaddr'
  local_net = IPAddr.new("127.0.0.0/24")
  %w(127.0.0.1 127.0.0.2 localhost).each do |ip|
    assert(local_net.include?(IPAddr.new(Socket.local_ip(ip))))
  end
end