net-dns 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +6 -14
  2. data/.gitignore +1 -1
  3. data/.rspec +1 -0
  4. data/.rubocop.yml +3 -0
  5. data/.rubocop_defaults.yml +364 -0
  6. data/.rubocop_todo.yml +207 -0
  7. data/.travis.yml +9 -16
  8. data/CHANGELOG.md +12 -1
  9. data/Gemfile +6 -2
  10. data/LICENSE.txt +56 -0
  11. data/README.md +94 -77
  12. data/Rakefile +23 -56
  13. data/bin/console +14 -0
  14. data/demo/check_soa.rb +27 -38
  15. data/demo/threads.rb +3 -7
  16. data/lib/net/dns.rb +4 -11
  17. data/lib/net/dns/core_ext.rb +8 -15
  18. data/lib/net/dns/header.rb +58 -66
  19. data/lib/net/dns/names.rb +25 -23
  20. data/lib/net/dns/packet.rb +136 -139
  21. data/lib/net/dns/question.rb +36 -39
  22. data/lib/net/dns/resolver.rb +103 -113
  23. data/lib/net/dns/resolver/socks.rb +45 -51
  24. data/lib/net/dns/resolver/timeouts.rb +17 -26
  25. data/lib/net/dns/rr.rb +107 -117
  26. data/lib/net/dns/rr/a.rb +46 -55
  27. data/lib/net/dns/rr/aaaa.rb +40 -49
  28. data/lib/net/dns/rr/classes.rb +26 -29
  29. data/lib/net/dns/rr/cname.rb +33 -41
  30. data/lib/net/dns/rr/hinfo.rb +44 -56
  31. data/lib/net/dns/rr/mr.rb +33 -42
  32. data/lib/net/dns/rr/mx.rb +37 -47
  33. data/lib/net/dns/rr/ns.rb +33 -41
  34. data/lib/net/dns/rr/null.rb +8 -11
  35. data/lib/net/dns/rr/ptr.rb +14 -20
  36. data/lib/net/dns/rr/soa.rb +27 -30
  37. data/lib/net/dns/rr/srv.rb +13 -17
  38. data/lib/net/dns/rr/txt.rb +8 -11
  39. data/lib/net/dns/rr/types.rb +97 -99
  40. data/lib/net/dns/version.rb +5 -13
  41. data/net-dns.gemspec +17 -29
  42. data/{fixtures → spec/fixtures}/resolv.conf +0 -0
  43. data/spec/spec_helper.rb +14 -0
  44. data/spec/unit/resolver/dns_timeout_spec.rb +36 -0
  45. data/spec/unit/resolver/tcp_timeout_spec.rb +46 -0
  46. data/spec/unit/resolver/udp_timeout_spec.rb +46 -0
  47. data/test/test_helper.rb +12 -3
  48. data/test/{header_test.rb → unit/header_test.rb} +43 -46
  49. data/test/{names_test.rb → unit/names_test.rb} +1 -1
  50. data/test/{packet_test.rb → unit/packet_test.rb} +3 -5
  51. data/test/{question_test.rb → unit/question_test.rb} +3 -5
  52. data/test/{resolver_test.rb → unit/resolver_test.rb} +10 -13
  53. data/test/{rr → unit/rr}/a_test.rb +10 -17
  54. data/test/{rr → unit/rr}/aaaa_test.rb +7 -14
  55. data/test/{rr → unit/rr}/classes_test.rb +14 -16
  56. data/test/{rr → unit/rr}/cname_test.rb +7 -14
  57. data/test/{rr → unit/rr}/hinfo_test.rb +16 -22
  58. data/test/{rr → unit/rr}/mr_test.rb +12 -18
  59. data/test/{rr → unit/rr}/mx_test.rb +18 -24
  60. data/test/{rr → unit/rr}/ns_test.rb +10 -16
  61. data/test/{rr → unit/rr}/types_test.rb +10 -8
  62. data/test/{rr_test.rb → unit/rr_test.rb} +33 -37
  63. metadata +77 -49
  64. data/test/resolver/timeouts_test.rb +0 -109
@@ -5,9 +5,7 @@ class Net::DNS::Resolver
5
5
  attr_reader :config
6
6
  end
7
7
 
8
-
9
- class ResolverTest < Test::Unit::TestCase
10
-
8
+ class ResolverTest < Minitest::Test
11
9
  def test_initialize
12
10
  assert_nothing_raised { Net::DNS::Resolver.new }
13
11
  end
@@ -17,7 +15,7 @@ class ResolverTest < Test::Unit::TestCase
17
15
  end
18
16
 
19
17
  def test_initialize_with_multi_name_servers
20
- resolver = Net::DNS::Resolver.new({:config_file => 'fixtures/resolv.conf'})
18
+ resolver = Net::DNS::Resolver.new(config_file: File.expand_path('../../spec/fixtures/resolv.conf', __dir__))
21
19
  assert_equal ['192.168.1.1', '192.168.1.2', '192.168.1.3', '192.168.1.4'], resolver.nameservers
22
20
  end
23
21
 
@@ -28,7 +26,7 @@ class ResolverTest < Test::Unit::TestCase
28
26
  end
29
27
 
30
28
  def test_query_with_no_nameservers_should_raise_resolvererror
31
- assert_raises(Net::DNS::Resolver::Error) { Net::DNS::Resolver.new(:nameservers => []).query("example.com") }
29
+ assert_raises(Net::DNS::Resolver::Error) { Net::DNS::Resolver.new(nameservers: []).query("example.com") }
32
30
  end
33
31
 
34
32
  # def test_send_to_ipv6_nameserver_should_not_raise_einval
@@ -58,7 +56,7 @@ class ResolverTest < Test::Unit::TestCase
58
56
 
59
57
  def test_make_query_packet_from_string_like_ipv6
60
58
  packet = _make_query_packet("2001:1ac0::200:0:a5d1:6004:2", Net::DNS::A, cls = Net::DNS::IN)
61
- assert_equal "2.0.0.0.4.0.0.6.1.d.5.a.0.0.0.0.0.0.2.0.0.0.0.0.0.c.a.1.1.0.0.2.ip6.arpa", packet.question.first.qName
59
+ assert_equal "2.0.0.0.4.0.0.6.1.d.5.a.0.0.0.0.0.0.2.0.0.0.0.0.0.c.a.1.1.0.0.2.ip6.arpa", packet.question.first.qName
62
60
  assert_equal Net::DNS::PTR.to_i, packet.question.first.qType.to_i
63
61
  assert_equal Net::DNS::IN.to_i, packet.question.first.qClass.to_i
64
62
  end
@@ -79,33 +77,33 @@ class ResolverTest < Test::Unit::TestCase
79
77
 
80
78
  def test_should_return_state_without_exception
81
79
  res = Net::DNS::Resolver.new
82
- assert_nothing_raised {res.state}
80
+ assert_nothing_raised { res.state }
83
81
  end
84
82
 
85
83
  RubyPlatforms = [
86
- ["darwin9.0", false], # Mac OS X
84
+ ["darwin9.0", false], # Mac OS X
87
85
  ["darwin", false], # JRuby on Mac OS X
88
86
  ["linux-gnu", false],
89
87
  ["mingw32", true], # ruby 1.8.6 (2008-03-03 patchlevel 114) [i386-mingw32]
90
88
  ["mswin32", true], # ruby 1.8.6 (2008-03-03 patchlevel 114) [i386-mswin32]
91
89
  ["mswin32", true], # ruby 1.8.6 (2008-04-22 rev 6555) [x86-jruby1.1.1]
92
- ]
90
+ ].freeze
93
91
 
94
92
  C = Object.const_get(defined?(RbConfig) ? :RbConfig : :Config)::CONFIG
95
93
 
96
94
  def test_self_platform_windows_question
97
95
  RubyPlatforms.each do |platform, is_windows|
98
96
  assert_equal is_windows,
99
- override_platform(platform) { Net::DNS::Resolver.platform_windows? },
100
- "Expected `#{is_windows}' with platform `#{platform}'"
97
+ override_platform(platform) { Net::DNS::Resolver.platform_windows? },
98
+ "Expected `#{is_windows}' with platform `#{platform}'"
101
99
  end
102
100
  end
103
101
 
104
-
105
102
  private
106
103
 
107
104
  def override_platform(new_platform, &block)
108
105
  raise LocalJumpError, "no block given" unless block_given?
106
+
109
107
  old_platform = C["host_os"]
110
108
  C["host_os"] = new_platform
111
109
  result = yield
@@ -113,5 +111,4 @@ class ResolverTest < Test::Unit::TestCase
113
111
  C["host_os"] = old_platform
114
112
  result
115
113
  end
116
-
117
114
  end
@@ -1,24 +1,22 @@
1
1
  require 'test_helper'
2
2
  require 'net/dns/rr'
3
3
 
4
- class RRATest < Test::Unit::TestCase
5
-
4
+ class RRATest < Minitest::Test
6
5
  def setup
7
6
  @rr_name = "google.com."
8
7
  @rr_type = "A"
9
8
  @rr_cls = "IN"
10
- @rr_ttl = 10000
9
+ @rr_ttl = 10_000
11
10
  @rr_value = "64.233.187.99"
12
11
  @rr_address = IPAddr.new(@rr_value)
13
12
 
14
13
  @rr_output = "google.com. 10000 IN A 64.233.187.99"
15
14
 
16
- @rr = Net::DNS::RR::A.new(:name => @rr_name, :address => @rr_address, :ttl => @rr_ttl)
15
+ @rr = Net::DNS::RR::A.new(name: @rr_name, address: @rr_address, ttl: @rr_ttl)
17
16
  end
18
17
 
19
-
20
18
  def test_initialize_from_hash
21
- @record = Net::DNS::RR::A.new(:name => @rr_name, :address => @rr_value, :ttl => @rr_ttl)
19
+ @record = Net::DNS::RR::A.new(name: @rr_name, address: @rr_value, ttl: @rr_ttl)
22
20
  assert_equal @rr_output, @record.to_s
23
21
  assert_equal @rr_name, @record.name
24
22
  assert_equal @rr_type, @record.type
@@ -51,16 +49,15 @@ class RRATest < Test::Unit::TestCase
51
49
  assert_equal @rr_value, @record.value
52
50
  end
53
51
 
54
-
55
52
  InvalidArguments = [
56
- { :name => "google.com", :address => "255.256" },
57
- { :name => "google.com" },
53
+ { name: "google.com", address: "255.256" },
54
+ { name: "google.com" },
58
55
  Object.new,
59
56
  Array.new(7),
60
57
  "10800 IN A",
61
58
  "google.com. 10800 IN B",
62
59
  "google.com. 10800 IM A",
63
- ]
60
+ ].freeze
64
61
 
65
62
  InvalidArguments.each_with_index do |arguments, index|
66
63
  define_method "test_initialize_should_raise_with_invalid_arguments_#{index}" do
@@ -68,9 +65,8 @@ class RRATest < Test::Unit::TestCase
68
65
  end
69
66
  end
70
67
 
71
-
72
68
  def test_address_getter
73
- assert_equal @rr_address, @rr.address
69
+ assert_equal @rr_address, @rr.address
74
70
  end
75
71
 
76
72
  def test_address_setter
@@ -81,7 +77,7 @@ class RRATest < Test::Unit::TestCase
81
77
  assert_equal expected, @rr.address
82
78
 
83
79
  expected = IPAddr.new("64.233.187.90")
84
- assert_equal expected, @rr.address = 1089059674
80
+ assert_equal expected, @rr.address = 1_089_059_674
85
81
  assert_equal expected, @rr.address
86
82
 
87
83
  expected = IPAddr.new("64.233.187.80")
@@ -89,12 +85,10 @@ class RRATest < Test::Unit::TestCase
89
85
  assert_equal expected, @rr.address
90
86
  end
91
87
 
92
-
93
88
  def test_value
94
89
  assert_equal @rr_value, @rr.value
95
90
  end
96
91
 
97
-
98
92
  def test_inspect
99
93
  assert_equal "google.com. 10000 IN A 64.233.187.99",
100
94
  @rr.inspect
@@ -106,8 +100,7 @@ class RRATest < Test::Unit::TestCase
106
100
  end
107
101
 
108
102
  def test_to_a
109
- assert_equal ["google.com.", 10000, "IN", "A", "64.233.187.99"],
103
+ assert_equal ["google.com.", 10_000, "IN", "A", "64.233.187.99"],
110
104
  @rr.to_a
111
105
  end
112
-
113
106
  end
@@ -1,8 +1,7 @@
1
1
  require 'test_helper'
2
2
  require 'net/dns/rr'
3
3
 
4
- class RRAAAATest < Test::Unit::TestCase
5
-
4
+ class RRAAAATest < Minitest::Test
6
5
  def setup
7
6
  @rr_name = "www.nic.it."
8
7
  @rr_type = "AAAA"
@@ -13,12 +12,11 @@ class RRAAAATest < Test::Unit::TestCase
13
12
 
14
13
  @rr_output = "www.nic.it. 60 IN AAAA 2a00:d40:1:1::239"
15
14
 
16
- @rr = Net::DNS::RR::AAAA.new(:name => @rr_name, :address => @rr_address, :ttl => @rr_ttl)
15
+ @rr = Net::DNS::RR::AAAA.new(name: @rr_name, address: @rr_address, ttl: @rr_ttl)
17
16
  end
18
17
 
19
-
20
18
  def test_initialize_from_hash
21
- @record = Net::DNS::RR::AAAA.new(:name => @rr_name, :address => @rr_value, :ttl => @rr_ttl)
19
+ @record = Net::DNS::RR::AAAA.new(name: @rr_name, address: @rr_value, ttl: @rr_ttl)
22
20
  assert_equal @rr_output, @record.to_s
23
21
  assert_equal @rr_name, @record.name
24
22
  assert_equal @rr_type, @record.type
@@ -51,16 +49,15 @@ class RRAAAATest < Test::Unit::TestCase
51
49
  assert_equal @rr_value, @record.value
52
50
  end
53
51
 
54
-
55
52
  InvalidArguments = [
56
- { :name => "google.com", :address => "2a00" },
57
- { :name => "google.com" },
53
+ { name: "google.com", address: "2a00" },
54
+ { name: "google.com" },
58
55
  Object.new,
59
56
  Array.new(7),
60
57
  "10800 IN AAAA",
61
58
  # FIXME: "google.com. 10800 IN B",
62
59
  # FIXME: "google.com. 10800 IM AAAA",
63
- ]
60
+ ].freeze
64
61
 
65
62
  InvalidArguments.each_with_index do |arguments, index|
66
63
  define_method "test_initialize_should_raise_with_invalid_arguments_#{index}" do
@@ -68,9 +65,8 @@ class RRAAAATest < Test::Unit::TestCase
68
65
  end
69
66
  end
70
67
 
71
-
72
68
  def test_address_getter
73
- assert_equal @rr_address, @rr.address
69
+ assert_equal @rr_address, @rr.address
74
70
  end
75
71
 
76
72
  def test_address_setter
@@ -85,12 +81,10 @@ class RRAAAATest < Test::Unit::TestCase
85
81
  assert_equal expected, @rr.address
86
82
  end
87
83
 
88
-
89
84
  def test_value
90
85
  assert_equal @rr_value, @rr.value
91
86
  end
92
87
 
93
-
94
88
  def test_inspect
95
89
  assert_equal "www.nic.it. 60 IN AAAA 2a00:d40:1:1::239",
96
90
  @rr.inspect
@@ -105,5 +99,4 @@ class RRAAAATest < Test::Unit::TestCase
105
99
  assert_equal ["www.nic.it.", 60, "IN", "AAAA", "2a00:d40:1:1::239"],
106
100
  @rr.to_a
107
101
  end
108
-
109
102
  end
@@ -1,22 +1,19 @@
1
1
  require 'test_helper'
2
2
  require 'net/dns/rr'
3
3
 
4
- class RRClassesTest < Test::Unit::TestCase
5
-
4
+ class RRClassesTest < Minitest::Test
6
5
  def setup
7
- @classes = {
8
- }
6
+ @classes = {}
9
7
  @regexp_string = "ANY|CH|HS|IN|NONE"
10
8
  end
11
9
 
12
-
13
10
  StrAndNum = [
14
- ['IN' , 1],
15
- ['CH' , 3],
16
- ['HS' , 4],
17
- ['NONE' , 254],
18
- ['ANY' , 255],
19
- ]
11
+ ['IN', 1],
12
+ ['CH', 3],
13
+ ['HS', 4],
14
+ ['NONE', 254],
15
+ ['ANY', 255],
16
+ ].freeze
20
17
 
21
18
  StrAndNum.each do |str, num|
22
19
  define_method "test_initialize_from_str_#{str}" do
@@ -32,10 +29,9 @@ class RRClassesTest < Test::Unit::TestCase
32
29
  end
33
30
 
34
31
  def test_initialize_should_raise_with_invalid_class
35
- assert_raises(ArgumentError) { Net::DNS::RR::Classes.new(Hash.new) }
32
+ assert_raises(ArgumentError) { Net::DNS::RR::Classes.new({}) }
36
33
  end
37
34
 
38
-
39
35
  def test_inspect
40
36
  assert_equal 1, Net::DNS::RR::Classes.new(1).inspect
41
37
  assert_equal 1, Net::DNS::RR::Classes.new("IN").inspect
@@ -51,8 +47,9 @@ class RRClassesTest < Test::Unit::TestCase
51
47
  assert_equal 1, Net::DNS::RR::Classes.new("IN").to_i
52
48
  end
53
49
 
54
-
55
50
  def test_self_default
51
+ @_default = Net::DNS::RR::Classes.default
52
+
56
53
  # Default type should be ANY => 255
57
54
  instance = Net::DNS::RR::Classes.new(nil)
58
55
  assert_equal 1, instance.to_i
@@ -68,6 +65,8 @@ class RRClassesTest < Test::Unit::TestCase
68
65
  instance = Net::DNS::RR::Classes.new(nil)
69
66
  assert_equal 1, instance.to_i
70
67
  assert_equal "IN", instance.to_s
68
+ ensure
69
+ Net::DNS::RR::Classes.default = Net::DNS::RR::Classes::CLASSES.invert[@_default]
71
70
  end
72
71
 
73
72
  def test_self_valid?
@@ -75,11 +74,10 @@ class RRClassesTest < Test::Unit::TestCase
75
74
  assert Net::DNS::RR::Classes.valid?(1)
76
75
  assert !Net::DNS::RR::Classes.valid?("Q")
77
76
  assert !Net::DNS::RR::Classes.valid?(256)
78
- assert_raises(ArgumentError) { Net::DNS::RR::Classes.valid?(Hash.new) }
77
+ assert_raises(ArgumentError) { Net::DNS::RR::Classes.valid?({}) }
79
78
  end
80
79
 
81
80
  def test_self_regexp
82
81
  assert_equal @regexp_string, Net::DNS::RR::Classes.regexp
83
82
  end
84
-
85
83
  end
@@ -1,24 +1,22 @@
1
1
  require 'test_helper'
2
2
  require 'net/dns/rr'
3
3
 
4
- class RRCNAMETest < Test::Unit::TestCase
5
-
4
+ class RRCNAMETest < Minitest::Test
6
5
  def setup
7
6
  @rr_name = "www.google.com."
8
7
  @rr_type = "CNAME"
9
8
  @rr_cls = "IN"
10
- @rr_ttl = 550317
9
+ @rr_ttl = 550_317
11
10
  @rr_value = "www.l.google.com."
12
11
  @rr_cname = @rr_value
13
12
 
14
13
  @rr_output = "www.google.com. 550317 IN CNAME www.l.google.com."
15
14
 
16
- @rr = Net::DNS::RR::CNAME.new(:name => @rr_name, :cname => @rr_cname, :ttl => @rr_ttl)
15
+ @rr = Net::DNS::RR::CNAME.new(name: @rr_name, cname: @rr_cname, ttl: @rr_ttl)
17
16
  end
18
17
 
19
-
20
18
  def test_initialize_from_hash
21
- @record = Net::DNS::RR::CNAME.new(:name => @rr_name, :cname => @rr_value, :ttl => @rr_ttl)
19
+ @record = Net::DNS::RR::CNAME.new(name: @rr_name, cname: @rr_value, ttl: @rr_ttl)
22
20
  assert_equal @rr_output, @record.to_s
23
21
  assert_equal @rr_name, @record.name
24
22
  assert_equal @rr_type, @record.type
@@ -51,16 +49,15 @@ class RRCNAMETest < Test::Unit::TestCase
51
49
  assert_equal @rr_value, @record.value
52
50
  end
53
51
 
54
-
55
52
  InvalidArguments = [
56
53
  # FIXME: { :name => "google.com", :cname => "foo___bar" },
57
54
  # FIXME: { :name => "google.com", :cname => "foo$bar" },
58
- { :name => "google.com" },
55
+ { name: "google.com" },
59
56
  Object.new,
60
57
  Array.new(7),
61
58
  "10800 IN CNAME",
62
59
  "google.com. 10800 IN CNAME",
63
- ]
60
+ ].freeze
64
61
 
65
62
  InvalidArguments.each_with_index do |arguments, index|
66
63
  define_method "test_initialize_should_raise_with_invalid_arguments_#{index}" do
@@ -68,17 +65,14 @@ class RRCNAMETest < Test::Unit::TestCase
68
65
  end
69
66
  end
70
67
 
71
-
72
68
  def test_cname_getter
73
69
  assert_equal @rr_cname, @rr.cname
74
70
  end
75
71
 
76
-
77
72
  def test_value
78
73
  assert_equal @rr_value, @rr.value
79
74
  end
80
75
 
81
-
82
76
  def test_inspect
83
77
  assert_equal "www.google.com. 550317 IN CNAME www.l.google.com.",
84
78
  @rr.inspect
@@ -90,8 +84,7 @@ class RRCNAMETest < Test::Unit::TestCase
90
84
  end
91
85
 
92
86
  def test_to_a
93
- assert_equal ["www.google.com.", 550317, "IN", "CNAME", "www.l.google.com."],
87
+ assert_equal ["www.google.com.", 550_317, "IN", "CNAME", "www.l.google.com."],
94
88
  @rr.to_a
95
89
  end
96
-
97
90
  end
@@ -2,30 +2,28 @@ require 'test_helper'
2
2
  require 'net/dns/rr'
3
3
  require 'net/dns/rr/hinfo'
4
4
 
5
- class RRHINFOTest < Test::Unit::TestCase
6
-
5
+ class RRHINFOTest < Minitest::Test
7
6
  def setup
8
7
  @rr_name = ""
9
8
  @rr_type = "HINFO"
10
9
  @rr_cls = "IN"
11
10
  @rr_ttl = nil
12
- @rr_value = %Q{"PC-Intel-700mhz" "Redhat Linux 7.1"}
13
- @rr_output = %Q{ IN HINFO "PC-Intel-700mhz" "Redhat Linux 7.1"}
11
+ @rr_value = '"PC-Intel-700mhz" "Redhat Linux 7.1"'
12
+ @rr_output = ' IN HINFO "PC-Intel-700mhz" "Redhat Linux 7.1"'
14
13
 
15
14
  @rr_cpu = "PC-Intel-700mhz"
16
15
  @rr_os = "Redhat Linux 7.1"
17
16
 
18
- @rr = Net::DNS::RR::HINFO.new(:name => @rr_name, :cpu => @rr_cpu, :os => @rr_os)
17
+ @rr = Net::DNS::RR::HINFO.new(name: @rr_name, cpu: @rr_cpu, os: @rr_os)
19
18
  end
20
19
 
21
-
22
20
  def test_initialize_from_hash
23
- @record = Net::DNS::RR::HINFO.new(:name => @rr_name, :cpu => @rr_cpu, :os => @rr_os)
21
+ @record = Net::DNS::RR::HINFO.new(name: @rr_name, cpu: @rr_cpu, os: @rr_os)
24
22
  assert_equal @rr_output, @record.to_s
25
23
  assert_equal @rr_name, @record.name
26
24
  assert_equal @rr_type, @record.type
27
25
  assert_equal @rr_cls, @record.cls
28
- assert_equal 10800, @record.ttl
26
+ assert_equal 10_800, @record.ttl
29
27
  assert_equal @rr_value, @record.value
30
28
 
31
29
  assert_equal @rr_cpu, @record.cpu
@@ -33,7 +31,7 @@ class RRHINFOTest < Test::Unit::TestCase
33
31
  end
34
32
 
35
33
  def test_initialize_from_string
36
- @record = Net::DNS::RR::HINFO.new(%Q{#{@rr_name} #{@rr_ttl} #{@rr_cls} #{@rr_type} PC-Intel-700mhz "Redhat Linux 7.1"})
34
+ @record = Net::DNS::RR::HINFO.new(%Q(#{@rr_name} #{@rr_ttl} #{@rr_cls} #{@rr_type} PC-Intel-700mhz "Redhat Linux 7.1"))
37
35
  assert_equal @rr_output, @record.to_s
38
36
  assert_equal @rr_value, @record.value
39
37
 
@@ -47,14 +45,15 @@ class RRHINFOTest < Test::Unit::TestCase
47
45
  # FIXME: assert_equal @rr_name, @record.name
48
46
  assert_equal @rr_type, @record.type
49
47
  assert_equal @rr_cls, @record.cls
50
- assert_equal 10800, @record.ttl
48
+ assert_equal 10_800, @record.ttl
51
49
  assert_equal @rr_value, @record.value
52
50
 
53
51
  assert_equal @rr_cpu, @record.cpu
54
52
  assert_equal @rr_os, @record.os
55
53
  end
56
54
 
57
- # FIXME: Can't get valid data
55
+ # FIXME: Can't get valid data
56
+ #
58
57
  # def test_parse
59
58
  # data = "\002in\000\000\r\000\001\000\000*0\000!\017PC-Intel-700mhz\020Redhat Linux 7.1"
60
59
  # @record = Net::DNS::RR.parse(data)
@@ -69,14 +68,13 @@ class RRHINFOTest < Test::Unit::TestCase
69
68
  # assert_equal @rr_os, @record.os
70
69
  # end
71
70
 
72
-
73
71
  InvalidArguments = [
74
- { :name => "google.com" },
72
+ { name: "google.com" },
75
73
  Object.new,
76
74
  Array.new(7),
77
75
  "10800 IN HINFO",
78
76
  "IN HINFO",
79
- ]
77
+ ].freeze
80
78
 
81
79
  InvalidArguments.each_with_index do |arguments, index|
82
80
  define_method "test_initialize_should_raise_with_invalid_arguments_#{index}" do
@@ -84,7 +82,6 @@ class RRHINFOTest < Test::Unit::TestCase
84
82
  end
85
83
  end
86
84
 
87
-
88
85
  def test_cpu
89
86
  assert_equal @rr_cpu, @rr.cpu
90
87
  end
@@ -93,25 +90,22 @@ class RRHINFOTest < Test::Unit::TestCase
93
90
  assert_equal @rr_os, @rr.os
94
91
  end
95
92
 
96
-
97
93
  def test_value
98
- assert_equal %Q{"PC-Intel-700mhz" "Redhat Linux 7.1"}, @rr.value
94
+ assert_equal '"PC-Intel-700mhz" "Redhat Linux 7.1"', @rr.value
99
95
  end
100
96
 
101
-
102
97
  def test_inspect
103
- assert_equal %Q{ IN HINFO "PC-Intel-700mhz" "Redhat Linux 7.1"},
98
+ assert_equal ' IN HINFO "PC-Intel-700mhz" "Redhat Linux 7.1"',
104
99
  @rr.inspect
105
100
  end
106
101
 
107
102
  def test_to_s
108
- assert_equal %Q{ IN HINFO "PC-Intel-700mhz" "Redhat Linux 7.1"},
103
+ assert_equal ' IN HINFO "PC-Intel-700mhz" "Redhat Linux 7.1"',
109
104
  @rr.to_s
110
105
  end
111
106
 
112
107
  def test_to_a
113
- assert_equal [nil, nil, "IN", "HINFO", %Q{"PC-Intel-700mhz" "Redhat Linux 7.1"}],
108
+ assert_equal [nil, nil, "IN", "HINFO", '"PC-Intel-700mhz" "Redhat Linux 7.1"'],
114
109
  @rr.to_a
115
110
  end
116
-
117
111
  end