test/test_gman_domains.rb in gman-5.0.9 vs test/test_gman_domains.rb in gman-6.0.0
- old
+ new
@@ -1,28 +1,33 @@
require File.join(File.dirname(__FILE__), 'helper')
-class TestDomains < Minitest::Test
+class TestGmanDomains < Minitest::Test
+ WHITELIST = ['non-us gov', 'non-us mil', 'US Federal'].freeze
- WHITELIST = [ "non-us gov", "non-us mil", "US Federal"]
-
def resolve_domains?
- ENV["GMAN_RESOLVE_DOMAINS"] == "true"
+ ENV['GMAN_RESOLVE_DOMAINS'] == 'true'
end
- should "only contains valid domains" do
+ 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..."
+ importer.logger.info <<-MSG
+ Validating that all domains resolve. This may take a while...
+ MSG
else
- importer.logger.info "Skipping domain resolution. Run `GMAN_RESOLVE_DOMAINS=true rake test` to validate that domains resolve."
+ 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|
+ list = Gman::DomainList.current.list
+ Parallel.each(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?)
+ options = { skip_dupe: true, skip_resolve: !resolve_domains? }
+ importer.valid_domain?(domain, options)
}
end
- assert_equal [], invalid.flatten.reject { |e| e.empty? }
+ assert_equal [], invalid.flatten.reject(&:empty?)
end
end