Sha256: 86a0f2f2dc1b47835e6a00d993e1ab62daaf0b3536667d7ffd971478131205b8

Contents?: true

Size: 937 Bytes

Versions: 12

Compression:

Stored size: 937 Bytes

Contents

require File.join(File.dirname(__FILE__), 'helper')

class TestDomains < Minitest::Test

  WHITELIST = [ "non-us gov", "non-us mil", "US Federal"]

  def resolve_domains?
    ENV["GMAN_RESOLVE_DOMAINS"] == "true"
  end

  should "only contains valid domains" do
    importer = Gman::Importer.new({})
    if resolve_domains?
      importer.logger.info "Validating that all domains resolve. This may take a while..."
    else
      importer.logger.info "Skipping domain resolution. Run `GMAN_RESOLVE_DOMAINS=true rake test` to validate that domains resolve."
    end

    invalid = []
    Parallel.each(Gman::DomainList.current.list, :in_threads => 2) do |group, domains|
      next if WHITELIST.include?(group)
      invalid.push domains.reject { |domain|
        importer.valid_domain?(domain, :skip_dupe => true, :skip_resolve => !resolve_domains?)
      }
    end
    assert_equal [], invalid.flatten.reject { |e| e.empty? }
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
gman-5.0.9 test/test_gman_domains.rb
gman-5.0.8 test/test_gman_domains.rb
gman-5.0.7 test/test_gman_domains.rb
gman-5.0.6 test/test_gman_domains.rb
gman-5.0.5 test/test_gman_domains.rb
gman-5.0.4 test/test_gman_domains.rb
gman-5.0.3 test/test_gman_domains.rb
gman-5.0.2 test/test_gman_domains.rb
gman-5.0.1 test/test_gman_domains.rb
gman-5.0.0 test/test_gman_domains.rb
gman-4.7.1 test/test_gman_domains.rb
gman-4.7.0 test/test_gman_domains.rb