Sha256: af9ec300e34b5854f0dbd3d4f99156bf37f112d9762ea9a3e2a948535274b964

Contents?: true

Size: 898 Bytes

Versions: 1

Compression:

Stored size: 898 Bytes

Contents

require 'test_helper'

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

  def setup
    @definition = [:tld, ".foo", "whois.foo", {}]
    @klass = Server::Adapters::Afilias
    @server = @klass.new(*@definition)
  end

  def test_query
    expected = "No match for DOMAIN.FOO."
    @server.expects(:ask_the_socket).with("domain.foo", "whois.afilias-grs.info", 43).returns(expected)
    assert_equal expected, @server.query("domain.foo")
  end

  def test_query_with_referral
    response = File.read(File.dirname(__FILE__) + "/../testcases/referrals/afilias.bz.txt")
    expected = "Match for DOMAIN.FOO."
    @server.expects(:ask_the_socket).with("domain.foo", "whois.afilias-grs.info", 43).returns(response)
    @server.expects(:ask_the_socket).with("domain.foo", "whois.belizenic.bz", 43).returns(expected)
    assert_equal expected, @server.query("domain.foo")
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
whois-0.5.0 test/adapters/afilias_test.rb