Sha256: 38ede601d3abed4089a54f4cd51fdbef425b0f13ea08be045229b87ddb50627d

Contents?: true

Size: 1.34 KB

Versions: 14

Compression:

Stored size: 1.34 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",
            ".gov",
            "foo.fed.us",
            "foo.state.il.us",
            "state.il.us",
            "foo@af.mil",
            "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

14 entries across 14 versions & 1 rubygems

Version Path
gman-4.7.1 test/test_gman.rb
gman-4.7.0 test/test_gman.rb
gman-4.6.5 test/test_gman.rb
gman-4.6.4 test/test_gman.rb
gman-4.6.3 test/test_gman.rb
gman-4.6.2 test/test_gman.rb
gman-4.6.1 test/test_gman.rb
gman-4.6.0 test/test_gman.rb
gman-4.5.1 test/test_gman.rb
gman-4.5.0 test/test_gman.rb
gman-4.4.3 test/test_gman.rb
gman-4.4.2 test/test_gman.rb
gman-4.4.1 test/test_gman.rb
gman-4.4.0 test/test_gman.rb