gman 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/gman.rb CHANGED
@@ -61,7 +61,8 @@ module Gman
61
61
  return false unless PublicSuffix.valid?(domain)
62
62
 
63
63
  # Ensure non-edu
64
- return false if domain_parts(domain).sld && Swot::is_academic?(domain)
64
+ return false if domain_parts(domain).sld && Swot::is_academic?(domain) &&
65
+ Swot::BLACKLIST.none? { |d| domain =~ /(\A|\.)#{Regexp.escape(d)}\z/ }
65
66
 
66
67
  # check using public suffix's standard logic
67
68
  rule = list.find domain
data/test/helper.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'bundler'
3
+ require 'minitest/autorun'
4
+
3
5
  begin
4
6
  Bundler.setup(:default, :development)
5
7
  rescue Bundler::BundlerError => e
@@ -7,7 +9,7 @@ rescue Bundler::BundlerError => e
7
9
  $stderr.puts "Run `bundle install` to install missing gems"
8
10
  exit e.status_code
9
11
  end
10
- require 'test/unit'
12
+
11
13
  require 'shoulda'
12
14
 
13
15
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
@@ -17,5 +19,3 @@ require 'net/dns'
17
19
  require 'net/dns/resolver'
18
20
  require './lib/gman/parser'
19
21
 
20
- class Test::Unit::TestCase
21
- end
data/test/test_gman.rb CHANGED
@@ -25,8 +25,7 @@ INVALID = [ "foo.bar.com",
25
25
  " ",
26
26
  ]
27
27
 
28
- class TestGman < Test::Unit::TestCase
29
-
28
+ class TestGman < Minitest::Test
30
29
 
31
30
  should "recognize government email addresses and domains" do
32
31
  VALID.each do |test|
@@ -54,9 +53,9 @@ class TestGman < Test::Unit::TestCase
54
53
  end
55
54
 
56
55
  should "not err out on invalid domains" do
57
- assert_equal false, Gman.valid?("foo@act.gov.au")
58
- assert_equal "act.gov.au", Gman.get_domain("foo@act.gov.au")
59
- assert_equal nil, Gman.domain_parts("foo@act.gov.au")
56
+ assert_equal false, Gman.valid?("foo@gov.invalid")
57
+ assert_equal "gov.invalid", Gman.get_domain("foo@gov.invalid")
58
+ assert_equal nil, Gman.domain_parts("foo@gov.invalid")
60
59
  end
61
60
 
62
61
  should "return public suffix domain" do
@@ -72,9 +71,7 @@ class TestGman < Test::Unit::TestCase
72
71
  end
73
72
 
74
73
  should "not err out on invalid hosts" do
75
- assert_nothing_raised do
76
- assert_equal nil, Gman.get_domain("</@foo.com")
77
- end
74
+ assert_equal nil, Gman.get_domain("</@foo.com")
78
75
  end
79
76
 
80
77
  should "returns the path to domains.txt" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gman
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-14 00:00:00.000000000 Z
11
+ date: 2014-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: public_suffix
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.4.1
19
+ version: '1.4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.4.1
26
+ version: '1.4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: swot
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.3.0
33
+ version: '0.3'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.3.0
40
+ version: '0.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: addressable
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.3.6
47
+ version: '2.3'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 2.3.6
54
+ version: '2.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement