⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Ruby master
All Projects
Ruby
»
Ruby master
Overview
Activity
Roadmap
Issues
Repository
Like
Download (1.1 KB)
Bug #6110
ยป test.rb
dkubb (Dan Kubb)
, 03/03/2012 05:42 PM
require
'minitest/autorun'
# These tests should pass on all versions of ruby, but currently fail with ruby-head.
# In this case I'm using a protected method from an object of the same type, and
# it should return true when I use other.respond_to?(method), but it is failing
# under ruby-head.
# I realize protected methods are not used as often as private and public
# methods, so it's quite possible this case has not been hit by others, and/or
# it is not tested as well as more commonly used features.
class
Thing
attr_reader
:value
protected
:value
def
initialize
(
value
)
@value
=
value
end
def
==
(
other
)
other
.
respond_to?
(
:value
)
&&
value
==
other
.
value
end
end
describe
Thing
,
'#=='
do
let
(
:thing
)
{
Thing
.
new
(
1
)
}
it
'is true when the other value is the same'
do
other
=
Thing
.
new
(
1
)
(
thing
==
other
).
must_equal
(
true
)
end
it
'is false when the other value is different'
do
other
=
Thing
.
new
(
0
)
(
thing
==
other
).
must_equal
(
false
)
end
it
'is false when the other object does not have a value'
do
other
=
Object
.
new
(
thing
==
other
).
must_equal
(
false
)
end
end
(1-1/1)
Loading...