Sha256: b58d743942cc6f35baea57be17714908a3e41f2dcc6ba756b82f37b8ce5046a1

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 KB

Contents

require 'test_helper'

class ServerAdaptersStandardTest < Test::Unit::TestCase

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

  def test_query
    response = "Whois Response"
    expected = response
    @server.expects(:ask_the_socket).with("domain.foo", "whois.foo", 43).returns(response)
    answer = @server.query("domain.foo")

    assert_equal expected,
                 answer.to_s
    assert_equal [Whois::Answer::Part.new(response, "whois.foo")],
                 answer.parts
  end

  def test_query_with_port
    response = "Whois Response"
    expected = response
    @server = @klass.new(:tld, ".foo", "whois.foo", { :port => 20 })
    @server.expects(:ask_the_socket).with("domain.foo", "whois.foo", 20).returns(response)
    answer = @server.query("domain.foo")

    assert_equal expected,
                 answer.to_s
    assert_equal [Whois::Answer::Part.new(response, "whois.foo")],
                 answer.parts
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
whois-1.2.2 test/whois/server/adapters/standard_test.rb
whois-1.2.1 test/whois/server/adapters/standard_test.rb
whois-1.2.0 test/whois/server/adapters/standard_test.rb
whois-1.1.8 test/server/adapters/standard_test.rb
whois-1.1.7 test/server/adapters/standard_test.rb
whois-1.1.6 test/server/adapters/standard_test.rb
whois-1.1.5 test/server/adapters/standard_test.rb