Sha256: 2e125ec3116ed345e5979c1ae9b26c8c60e5af802ae600cf420a6986d724c3ca

Contents?: true

Size: 879 Bytes

Versions: 21

Compression:

Stored size: 879 Bytes

Contents

require 'test_helper'

class ServerAdaptersFormattedTest < Test::Unit::TestCase

  def setup
    @definition = [:tld, ".de", "whois.denic.de", {:format => "-T dn,ace -C US-ASCII %s"}]
    @klass  = Whois::Server::Adapters::Formatted
    @server = @klass.new(*@definition)
  end

  def test_query
    @server.expects(:ask_the_socket).with("-T dn,ace -C US-ASCII domain.foo", "whois.denic.de", 43).returns("Whois Response")
    response = @server.query("domain.foo")
    assert_equal "Whois Response",
                 response.to_s
    assert_equal [Whois::Answer::Part.new(response, "whois.denic.de")],
                 @server.buffer
  end

  def test_query_should_raise_without_option_format
    @server = @klass.new(*[:tld, ".de", "whois.denic.de", {}])
    @server.expects(:ask_the_socket).never
    assert_raise(Whois::ServerError) { @server.query("domain.foo") }
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
whois-1.1.4 test/server/adapters/formatted_test.rb
whois-1.1.3 test/server/adapters/formatted_test.rb
whois-1.1.2 test/server/adapters/formatted_test.rb
whois-1.1.1 test/server/adapters/formatted_test.rb
whois-1.1.0 test/server/adapters/formatted_test.rb
whois-1.0.12 test/server/adapters/formatted_test.rb
whois-1.0.11 test/server/adapters/formatted_test.rb
whois-1.0.10 test/server/adapters/formatted_test.rb
whois-1.0.9 test/server/adapters/formatted_test.rb
whois-1.0.8 test/server/adapters/formatted_test.rb
whois-1.0.7 test/server/adapters/formatted_test.rb
whois-1.0.6 test/server/adapters/formatted_test.rb
whois-1.0.5 test/server/adapters/formatted_test.rb
whois-1.0.4 test/server/adapters/formatted_test.rb
whois-1.0.3 test/server/adapters/formatted_test.rb
whois-1.0.2 test/server/adapters/formatted_test.rb
whois-1.0.1 test/server/adapters/formatted_test.rb
whois-1.0.0 test/server/adapters/formatted_test.rb
whois-0.9.0 test/server/adapters/formatted_test.rb
whois-0.8.1 test/server/adapters/formatted_test.rb