Sha256: 2c750e93b53d7b1979d0f99bd9b172caaec86135409c92a983eddea80bd8f18f

Contents?: true

Size: 964 Bytes

Versions: 3

Compression:

Stored size: 964 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
    response = "No match for DOMAIN.FOO."
    expected = response
    @server.expects(:ask_the_socket).with("domain.foo", "whois.afilias-grs.info", 43).returns(response)
    assert_equal expected, @server.query("domain.foo")
  end

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

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
whois-0.5.3 test/adapters/afilias_test.rb
whois-0.5.2 test/adapters/afilias_test.rb
whois-0.5.1 test/adapters/afilias_test.rb