diff --git a/lib/async/dns/resolver.rb b/lib/async/dns/resolver.rb index 478beb3..22de8a9 100644 --- a/lib/async/dns/resolver.rb +++ b/lib/async/dns/resolver.rb @@ -103,7 +103,7 @@ def records_for(name, resource_classes) end end - if System.use_ipv6? + if System.ipv6? ADDRESS_RESOURCE_CLASSES = [Resolv::DNS::Resource::IN::A, Resolv::DNS::Resource::IN::AAAA] else ADDRESS_RESOURCE_CLASSES = [Resolv::DNS::Resource::IN::A] diff --git a/lib/async/dns/system.rb b/lib/async/dns/system.rb index 21a301b..51e3cf3 100644 --- a/lib/async/dns/system.rb +++ b/lib/async/dns/system.rb @@ -23,7 +23,7 @@ def self.hosts_path end end - def self.use_ipv6? + def self.ipv6? begin list = Socket.ip_address_list rescue NotImplementedError diff --git a/test/async/dns/resolver.rb b/test/async/dns/resolver.rb index 3a0f6f0..cc4b75b 100644 --- a/test/async/dns/resolver.rb +++ b/test/async/dns/resolver.rb @@ -30,7 +30,10 @@ addresses = resolver.addresses_for('google.com') expect(addresses).to have_value(be_a Resolv::IPv4) - expect(addresses).to have_value(be_a Resolv::IPv6) + + if Async::DNS::System.ipv6? + expect(addresses).to have_value(be_a Resolv::IPv6) + end end it "should recursively resolve CNAME records" do diff --git a/test/async/dns/server.rb b/test/async/dns/server.rb index d95162f..23f224d 100644 --- a/test/async/dns/server.rb +++ b/test/async/dns/server.rb @@ -47,17 +47,6 @@ def make_server(endpoint) answer: be(:empty?) ) end - - it "should return IPv4 and IPv6 addresses" do - response = resolver.query("www.google.com", Resolv::DNS::Resource::IN::A) - - expect(response).to have_attributes( - qr: be == 1, - rcode: be == Resolv::DNS::RCode::NoError, - question: have_attributes(size: be == 1), - answer: have_attributes(size: be > 0) - ) - end end with 'a large response' do