test/test_truncation.rb in rubydns-0.5.0 vs test/test_truncation.rb in rubydns-0.5.1
- old
+ new
@@ -5,18 +5,20 @@
require 'rubydns'
require 'rubydns/resolver'
require 'rubydns/extensions/string'
class TruncatedServer < RExec::Daemon::Base
+ SERVER_PORTS = [[:udp, '127.0.0.1', 5320], [:tcp, '127.0.0.1', 5320]]
+
@@base_directory = File.dirname(__FILE__)
Name = Resolv::DNS::Name
IN = Resolv::DNS::Resource::IN
def self.run
# Start the RubyDNS server
- RubyDNS::run_server(:listen => [[:udp, '0.0.0.0', 5320], [:tcp, '0.0.0.0', 5320]]) do
+ RubyDNS::run_server(:listen => SERVER_PORTS) do
match("truncation", IN::TXT) do |transaction|
text = "Hello World! " * 100
transaction.respond!(*text.chunked)
end
@@ -36,10 +38,10 @@
def teardown
TruncatedServer.stop
end
def test_tcp_failover
- resolver = RubyDNS::Resolver.new([[:udp, '127.0.0.1', 5320], [:tcp, '127.0.0.1', 5320]])
+ resolver = RubyDNS::Resolver.new(TruncatedServer::SERVER_PORTS)
EventMachine::run do
resolver.query("truncation", IN::TXT) do |response|