Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gitbourahlavignal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIGNAL Nicolas
gitbourahlavignal
Commits
d6138e2e
Commit
d6138e2e
authored
10 years ago
by
Mike Mackintosh
Browse files
Options
Downloads
Patches
Plain Diff
updated remaining tests for minitest
parent
fd2517ac
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
ipaddress.gemspec
+1
-1
1 addition, 1 deletion
ipaddress.gemspec
lib/ipaddress.rb
+1
-1
1 addition, 1 deletion
lib/ipaddress.rb
test/ipaddress/mongoid_test.rb
+2
-8
2 additions, 8 deletions
test/ipaddress/mongoid_test.rb
test/ipaddress_test.rb
+3
-3
3 additions, 3 deletions
test/ipaddress_test.rb
with
7 additions
and
13 deletions
ipaddress.gemspec
+
1
−
1
View file @
d6138e2e
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
Gem
::
Specification
.
new
do
|
s
|
Gem
::
Specification
.
new
do
|
s
|
s
.
name
=
%q{ipaddress}
s
.
name
=
%q{ipaddress}
s
.
version
=
"0.8.
0
"
s
.
version
=
"0.8.
1
"
s
.
required_rubygems_version
=
Gem
::
Requirement
.
new
(
">= 0"
)
if
s
.
respond_to?
:required_rubygems_version
=
s
.
required_rubygems_version
=
Gem
::
Requirement
.
new
(
">= 0"
)
if
s
.
respond_to?
:required_rubygems_version
=
s
.
authors
=
[
"Marco Ceresa"
]
s
.
authors
=
[
"Marco Ceresa"
]
...
...
This diff is collapsed.
Click to expand it.
lib/ipaddress.rb
+
1
−
1
View file @
d6138e2e
...
@@ -67,7 +67,7 @@ module IPAddress
...
@@ -67,7 +67,7 @@ module IPAddress
# #-> "10.1.1.1"
# #-> "10.1.1.1"
#
#
def
self
.
ntoa
(
uint
)
def
self
.
ntoa
(
uint
)
unless
(
uint
.
is_a?
Numeric
and
uint
<=
0xffffffff
)
unless
(
uint
.
is_a?
Numeric
and
uint
<=
0xffffffff
and
uint
>=
0
)
raise
(
::
ArgumentError
,
"not a long integer:
#{
uint
.
inspect
}
"
)
raise
(
::
ArgumentError
,
"not a long integer:
#{
uint
.
inspect
}
"
)
end
end
ret
=
[]
ret
=
[]
...
...
This diff is collapsed.
Click to expand it.
test/ipaddress/mongoid_test.rb
+
2
−
8
View file @
d6138e2e
require
'test_helper'
require
'test_helper'
require
'ipaddress/mongoid'
require
'ipaddress/mongoid'
class
MongoidTest
<
Test
::
Uni
t
::
Test
Case
class
MongoidTest
<
Minites
t
::
Test
def
setup
def
setup
@valid_host4
=
"172.16.10.1"
@valid_host4
=
"172.16.10.1"
...
@@ -14,7 +14,7 @@ class MongoidTest < Test::Unit::TestCase
...
@@ -14,7 +14,7 @@ class MongoidTest < Test::Unit::TestCase
@host6
=
IPAddress
.
parse
(
@valid_host6
)
@host6
=
IPAddress
.
parse
(
@valid_host6
)
@network4
=
IPAddress
.
parse
(
@valid_network4
)
@network4
=
IPAddress
.
parse
(
@valid_network4
)
@network6
=
IPAddress
.
parse
(
@valid_network6
)
@network6
=
IPAddress
.
parse
(
@valid_network6
)
@invalid_values
=
[
nil
,
""
,
1
,
"invalid"
]
@invalid_values
=
[
nil
,
""
,
"invalid"
]
end
end
def
test_mongoize
def
test_mongoize
...
@@ -37,9 +37,6 @@ class MongoidTest < Test::Unit::TestCase
...
@@ -37,9 +37,6 @@ class MongoidTest < Test::Unit::TestCase
assert_equal
@valid_network6
,
IPAddress
.
mongoize
(
@valid_network6_compressed
)
assert_equal
@valid_network6
,
IPAddress
.
mongoize
(
@valid_network6_compressed
)
@invalid_values
.
each
do
|
invalid_value
|
@invalid_values
.
each
do
|
invalid_value
|
# Invalid address should not raise error
assert_nothing_raised
{
IPAddress
.
mongoize
(
invalid_value
)}
# Invalid addresses should serialize to nil
# Invalid addresses should serialize to nil
assert_equal
nil
,
IPAddress
.
mongoize
(
invalid_value
)
assert_equal
nil
,
IPAddress
.
mongoize
(
invalid_value
)
end
end
...
@@ -59,9 +56,6 @@ class MongoidTest < Test::Unit::TestCase
...
@@ -59,9 +56,6 @@ class MongoidTest < Test::Unit::TestCase
assert_equal
@network6
,
IPAddress
.
demongoize
(
@valid_network6
)
assert_equal
@network6
,
IPAddress
.
demongoize
(
@valid_network6
)
@invalid_values
.
each
do
|
invalid_value
|
@invalid_values
.
each
do
|
invalid_value
|
# Invalid stored values should not raise error
assert_nothing_raised
{
IPAddress
.
demongoize
(
invalid_value
)}
# Invalid stored value should be loaded as nil
# Invalid stored value should be loaded as nil
assert_equal
nil
,
IPAddress
.
demongoize
(
invalid_value
)
assert_equal
nil
,
IPAddress
.
demongoize
(
invalid_value
)
end
end
...
...
This diff is collapsed.
Click to expand it.
test/ipaddress_test.rb
+
3
−
3
View file @
d6138e2e
...
@@ -52,9 +52,9 @@ class IPAddressTest < Minitest::Test
...
@@ -52,9 +52,9 @@ class IPAddressTest < Minitest::Test
assert_instance_of
@ipv4class
,
@method
.
call
(
@valid_ipv4_uint32
[
2
])
assert_instance_of
@ipv4class
,
@method
.
call
(
@valid_ipv4_uint32
[
2
])
assert_instance_of
@ipv4class
,
@method
.
call
(
@valid_ipv4_uint32
[
3
])
assert_instance_of
@ipv4class
,
@method
.
call
(
@valid_ipv4_uint32
[
3
])
assert_raise
(
ArgumentError
)
{
@method
.
call
(
@invalid_ipv4_uint32
[
0
])}
assert_raise
s
(
ArgumentError
)
{
@method
.
call
(
@invalid_ipv4_uint32
[
0
])}
assert_raise
(
ArgumentError
)
{
@method
.
call
(
@invalid_ipv4_uint32
[
1
])}
assert_raise
s
(
ArgumentError
)
{
@method
.
call
(
@invalid_ipv4_uint32
[
1
])}
assert_raise
(
ArgumentError
)
{
@method
.
call
(
@invalid_ipv4_uint32
[
2
])}
assert_raise
s
(
ArgumentError
)
{
@method
.
call
(
@invalid_ipv4_uint32
[
2
])}
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment