net-ping 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,102 +1,122 @@
1
- ################################################################
1
+ ########################################################################
2
2
  # test_net_ping_udp.rb
3
3
  #
4
- # Test case for the Net::Ping::UDP class. This should be run
5
- # via the 'test' or 'test:udp' Rake task.
4
+ # Test case for the Net::Ping::UDP class. This should be run via the
5
+ # 'test' or 'test:udp' Rake tasks.
6
6
  #
7
7
  # If someone could provide me a host where a udp ping actually
8
8
  # works (with a service check), I would appreciate it. :)
9
- ################################################################
9
+ ########################################################################
10
10
  require 'rubygems'
11
11
  gem 'test-unit'
12
12
 
13
13
  require 'test/unit'
14
14
  require 'net/ping/udp'
15
- include Net
16
-
17
- class TC_PingUDP < Test::Unit::TestCase
18
- def setup
19
- Ping::UDP.service_check = false
20
- @host = '127.0.0.1'
21
- @udp = Ping::UDP.new(@host)
22
- end
23
-
24
- def test_version
25
- assert_equal('1.3.2', Ping::UDP::VERSION)
26
- end
27
-
28
- def test_ping
29
- assert_respond_to(@udp, :ping)
30
- assert_nothing_raised{ @udp.ping }
31
- assert_nothing_raised{ @udp.ping(@host) }
32
- end
33
-
34
- def test_ping_aliases
35
- assert_respond_to(@udp, :ping?)
36
- assert_respond_to(@udp, :pingecho)
37
- assert_nothing_raised{ @udp.ping? }
38
- assert_nothing_raised{ @udp.ping?(@host) }
39
- assert_nothing_raised{ @udp.pingecho }
40
- assert_nothing_raised{ @udp.pingecho(@host) }
41
- end
42
-
43
- def test_ping_standard
44
- assert_equal(true, @udp.ping?)
45
- assert_equal(true, @udp.exception.nil?)
46
- end
47
-
48
- def test_bind
49
- assert_respond_to(@udp, :bind)
50
- assert_nothing_raised{ @udp.bind('127.0.0.1', 80) }
51
- end
15
+
16
+ class TC_Net_Ping_UDP < Test::Unit::TestCase
17
+ def setup
18
+ Net::Ping::UDP.service_check = false
19
+ @host = '127.0.0.1'
20
+ @udp = Net::Ping::UDP.new(@host)
21
+ end
22
+
23
+ test "ping basic functionality" do
24
+ assert_respond_to(@udp, :ping)
25
+ assert_nothing_raised{ @udp.ping }
26
+ end
27
+
28
+ test "ping accepts a host as an argument" do
29
+ assert_nothing_raised{ @udp.ping(@host) }
30
+ end
31
+
32
+ test "ping? is an alias for ping" do
33
+ assert_respond_to(@udp, :ping?)
34
+ assert_alias_method(@udp, :ping?, :ping)
35
+ end
36
+
37
+ test "pingecho is an alias for ping" do
38
+ assert_respond_to(@udp, :pingecho)
39
+ assert_alias_method(@udp, :pingecho, :ping)
40
+ end
41
+
42
+ test "a successful udp ping returns true" do
43
+ assert_true(@udp.ping?)
44
+ end
45
+
46
+ test "bind basic functionality" do
47
+ assert_respond_to(@udp, :bind)
48
+ assert_nothing_raised{ @udp.bind('127.0.0.1', 80) }
49
+ end
52
50
 
53
- def test_duration
54
- assert_nothing_raised{ @udp.ping }
55
- assert_respond_to(@udp, :duration)
56
- assert_kind_of(Float, @udp.duration)
57
- end
58
-
59
- def test_host
60
- assert_respond_to(@udp, :host)
61
- assert_respond_to(@udp, :host=)
62
- assert_equal('127.0.0.1', @udp.host)
63
- end
64
-
65
- def test_port
66
- assert_respond_to(@udp, :port)
67
- assert_respond_to(@udp, :port=)
68
- assert_equal(7, @udp.port)
69
- end
70
-
71
- def test_timeout
72
- assert_respond_to(@udp, :timeout)
73
- assert_respond_to(@udp, :timeout=)
74
- assert_equal(5, @udp.timeout)
75
- end
76
-
77
- def test_exception
78
- assert_respond_to(@udp, :exception)
79
- assert_nothing_raised{ @udp.ping }
80
- assert_nil(@udp.exception)
81
- end
82
-
83
- def test_warning
84
- assert_respond_to(@udp, :warning)
85
- end
51
+ test "duration basic functionality" do
52
+ assert_nothing_raised{ @udp.ping }
53
+ assert_respond_to(@udp, :duration)
54
+ assert_kind_of(Float, @udp.duration)
55
+ end
56
+
57
+ test "host basic functionality" do
58
+ assert_respond_to(@udp, :host)
59
+ assert_respond_to(@udp, :host=)
60
+ assert_equal('127.0.0.1', @udp.host)
61
+ end
62
+
63
+ test "port basic functionality" do
64
+ assert_respond_to(@udp, :port)
65
+ assert_respond_to(@udp, :port=)
66
+ assert_equal(7, @udp.port)
67
+ end
68
+
69
+ test "timeout basic functionality" do
70
+ assert_respond_to(@udp, :timeout)
71
+ assert_respond_to(@udp, :timeout=)
72
+ end
73
+
74
+ test "timeout default value is five" do
75
+ assert_equal(5, @udp.timeout)
76
+ end
77
+
78
+ test "exception basic functionality" do
79
+ assert_respond_to(@udp, :exception)
80
+ end
81
+
82
+ test "the exception attribute returns nil if the ping is successful" do
83
+ assert_true(@udp.ping?)
84
+ assert_nil(@udp.exception)
85
+ end
86
+
87
+ test "the exception attribute is not nil if the ping is unsuccessful" do
88
+ assert_false(@udp.ping?('www.ruby-lang.org'))
89
+ assert_not_nil(@udp.exception)
90
+ end
91
+
92
+ test "warning basic functionality" do
93
+ assert_respond_to(@udp, :warning)
94
+ end
95
+
96
+ test "the warning attribute returns nil if the ping is successful" do
97
+ assert_true(@udp.ping?)
98
+ assert_nil(@udp.warning)
99
+ end
86
100
 
87
- def test_service_check
88
- assert_respond_to(Ping::UDP, :service_check)
89
- assert_respond_to(Ping::UDP, :service_check=)
90
- assert_equal(false, Ping::UDP.service_check) # Set in setup
91
- end
101
+ test "service_check basic functionality" do
102
+ assert_respond_to(Net::Ping::UDP, :service_check)
103
+ assert_respond_to(Net::Ping::UDP, :service_check=)
104
+ end
105
+
106
+ test "service_check attribute has been set to false" do
107
+ assert_false(Net::Ping::UDP.service_check)
108
+ end
92
109
 
93
- def test_service_check_expected_failures
94
- assert_raise(ArgumentError){ Ping::UDP.service_check(1) }
95
- assert_raise(ArgumentError){ Ping::UDP.service_check = 1 }
96
- end
97
-
98
- def teardown
99
- @host = nil
100
- @udp = nil
101
- end
110
+ test "service_check getter method does not accept arguments" do
111
+ assert_raise(ArgumentError){ Net::Ping::UDP.service_check(1) }
112
+ end
113
+
114
+ test "service_check setter method only accepts boolean arguments" do
115
+ assert_raise(ArgumentError){ Net::Ping::UDP.service_check = 1 }
116
+ end
117
+
118
+ def teardown
119
+ @host = nil
120
+ @udp = nil
121
+ end
102
122
  end
@@ -22,10 +22,6 @@ class TC_Ping_WMI < Test::Unit::TestCase
22
22
  @wmi = Ping::WMI.new(@host) if @@windows
23
23
  end
24
24
 
25
- def test_version
26
- assert_equal('1.3.2', Ping::WMI::VERSION)
27
- end
28
-
29
25
  def test_ping_basic
30
26
  omit_unless(@@windows, 'skipped on Unix platforms')
31
27
  assert_respond_to(@wmi, :ping)
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-ping
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 3
8
+ - 3
9
+ version: 1.3.3
5
10
  platform: ruby
6
11
  authors:
7
12
  - Daniel J. Berger
@@ -9,20 +14,24 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-09-21 00:00:00 -06:00
17
+ date: 2010-06-21 00:00:00 -06:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: test-unit
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
23
- version: 2.0.3
24
- version:
25
- description: " The net-ping library provides a ping interface for Ruby. It includes\n separate TCP, HTTP, ICMP, UDP, WMI (for Windows) and external ping\n classes.\n"
27
+ segments:
28
+ - 2
29
+ - 0
30
+ - 9
31
+ version: 2.0.9
32
+ type: :development
33
+ version_requirements: *id001
34
+ description: " The net-ping library provides a ping interface for Ruby. It includes\n separate TCP, HTTP, ICMP, UDP, WMI (for Windows) and external ping\n classes.\n"
26
35
  email: djberg96@gmail.com
27
36
  executables: []
28
37
 
@@ -71,18 +80,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
71
80
  requirements:
72
81
  - - ">="
73
82
  - !ruby/object:Gem::Version
83
+ segments:
84
+ - 0
74
85
  version: "0"
75
- version:
76
86
  required_rubygems_version: !ruby/object:Gem::Requirement
77
87
  requirements:
78
88
  - - ">="
79
89
  - !ruby/object:Gem::Version
90
+ segments:
91
+ - 0
80
92
  version: "0"
81
- version:
82
93
  requirements: []
83
94
 
84
95
  rubyforge_project: shards
85
- rubygems_version: 1.3.5
96
+ rubygems_version: 1.3.6
86
97
  signing_key:
87
98
  specification_version: 3
88
99
  summary: A ping interface for Ruby.