1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix Resolv specs to not depend on a system /etc/hosts file

* 20190609T153804Z.fail.html.gz
* Thanks @naruse for the tip.
This commit is contained in:
Benoit Daloze 2019-06-10 12:45:00 +02:00
parent 614154bbb6
commit 60af6fef3c
5 changed files with 16 additions and 15 deletions

View file

@ -4,11 +4,11 @@ require 'resolv'
describe "Resolv#getaddress" do
platform_is_not :windows do
it "resolves localhost" do
res = Resolv.new([Resolv::Hosts.new])
hosts = Resolv::Hosts.new(fixture(__FILE__ , "hosts"))
res = Resolv.new([hosts])
lambda {
res.getaddress("localhost")
}.should_not raise_error(Resolv::ResolvError)
res.getaddress("localhost").should == "127.0.0.1"
res.getaddress("localhost4").should == "127.0.0.1"
end
end