Sha256: 3a7b2dd82bb73b0abcf5c2104aa24a059654141c3db07361836440c01b3df606

Contents?: true

Size: 1.35 KB

Versions: 10

Compression:

Stored size: 1.35 KB

Contents

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

VALID = [  "foo.gov",
            "http://foo.mil",
            "foo@bar.gc.ca",
            "foo.gov.au",
            "https://www.foo.gouv.fr",
            "foo@ci.champaign.il.us",
            "foo.bar.baz.gov.au",
            "foo@bar.gov.uk",
            "foo.gov",
            "foo.fed.us",
            "foo.state.il.us",
            "state.il.us",
            "foo@af.mil",
            "foo.gov.in"
        ]

INVALID = [ "foo.bar.com",
            "bar@foo.biz",
            "http://www.foo.biz",
            "foo.uk",
            "gov",
            "foo@k12.champaign.il.us",
            "foo@kii.gov.by",
            "foo",
            "",
            nil,
            " ",
            "foo.city.il.us",
            "foo.ci.il.us",
            "foo.zx.us",
            "foo@mail.gov.ua"
          ]

class TestGman < Minitest::Test

  VALID.each do |domain|
    should "recognize #{domain} as a government domain" do
      assert Gman::valid?(domain)
    end
  end

  INVALID.each do |domain|
    should "recognize #{domain} as a non-government domain" do
      refute Gman::valid?(domain)
    end
  end

  should "not allow educational domains" do
    assert_equal false, Gman::valid?("foo@gwu.edu")
  end

  should "returns the path to domains.txt" do
    assert_equal true, File.exists?(Gman.list_path)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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