Sha256: b61342c57973780c8856be11512f19fe4ce6ca2da848dfc15765439045eab327
Contents?: true
Size: 1.59 KB
Versions: 2
Compression:
Stored size: 1.59 KB
Contents
require 'spec_helper' require 'ronin/host_name' describe HostName do let(:domain) { 'localhost' } let(:ip) { '127.0.0.1' } subject { HostName.new(:address => domain) } it "should require an address" do host_name = HostName.new host_name.should_not be_valid end it "should alias #name to #address" do subject.name.should == subject.address end describe "lookup" do subject { HostName } let(:bad_ip) { '0.0.0.0' } it "should look up the host names for an IP Address" do host_names = subject.lookup(ip).map { |name| name.address } host_names.should include(domain) end it "should associate the host names with the original IP address" do host_names = subject.lookup(ip) host_names.each do |host| host.ip_addresses[0].address.should == ip end end it "should return an empty Array for unknown host names" do host_names = subject.lookup(bad_ip) host_names.should be_empty end end describe "#lookup!" do let(:bad_domain) { '.bad.domain.com.' } it "should look up the IP Addresses for the host name" do ips = subject.lookup! ips.should_not be_empty ips[0].address.should == ip end it "should associate the IP addresses with the original host name" do ips = subject.lookup! ips.each do |ip| ip.host_names[0].address.should == domain end end it "should return an empty Array for unknown host names" do ips = HostName.new(:address => bad_domain).lookup! ips.should be_empty end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ronin-1.2.0 | spec/host_name_spec.rb |
ronin-1.1.0 | spec/host_name_spec.rb |