Sha256: cd6bd065400807c7981845e141dbed6ae0a24fb8e308527d0dcad45f7596b258

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

require 'test_helper'

class DeprecatedWhoisTest < Test::Unit::TestCase
  include Whois

  def test_with_ipv4
    w  = Whois.new('72.17.207.99')

    response = w.search_whois

    assert_equal(response, w.all)
    assert_equal(IPAddr.new('72.17.207.99'), w.ip)
    assert_instance_of(Server::Arin, w.server)
    assert_nil w.host
  end

  def test_with_ipv4_as_ipaddr
    ip = IPAddr.new '72.17.207.99'
    w  = Whois.new(ip)

    response = w.search_whois

    assert_equal(response, w.all)
    assert_equal(IPAddr.new('72.17.207.99'), w.ip)
    assert_instance_of(Server::Arin, w.server)
    assert_nil w.host
  end

  def test_with_ipv6
    w  = Whois.new('2001:db8::1428:57ab')

    response = w.search_whois

    assert_equal(response, w.all)
    assert_equal(IPAddr.new('2001:db8::1428:57ab'), w.ip)
    assert_instance_of(Server::Apnic, w.server)
    assert_nil w.host
  end

  def test_with_ipv6_as_ipaddr
    ip = IPAddr.new '2001:db8::1428:57ab'
    w  = Whois.new(ip)

    response = w.search_whois

    assert_equal(response, w.all)
    assert_equal(IPAddr.new('2001:db8::1428:57ab'), w.ip)
    assert_instance_of(Server::Apnic, w.server)
    assert_nil w.host
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
whois-0.5.0 test/deprecated_test.rb
whois-0.5.1 test/deprecated_test.rb