[Feature #15408] Fix up _id2ref_spec.rb
This commit is contained in:
parent
3306d7d2f9
commit
c75202c57e
@ -1,6 +1,18 @@
|
|||||||
require_relative '../../spec_helper'
|
require_relative '../../spec_helper'
|
||||||
|
|
||||||
describe "ObjectSpace._id2ref" do
|
ruby_version_is "3.5" do
|
||||||
|
describe "ObjectSpace._id2ref" do
|
||||||
|
it "is deprecated" do
|
||||||
|
id = nil.object_id
|
||||||
|
-> {
|
||||||
|
ObjectSpace._id2ref(id)
|
||||||
|
}.should complain(/warning: ObjectSpace\._id2ref is deprecated/)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
ruby_version_is ""..."3.5" do
|
||||||
|
describe "ObjectSpace._id2ref" do
|
||||||
it "converts an object id to a reference to the object" do
|
it "converts an object id to a reference to the object" do
|
||||||
s = "I am a string"
|
s = "I am a string"
|
||||||
r = ObjectSpace._id2ref(s.object_id)
|
r = ObjectSpace._id2ref(s.object_id)
|
||||||
@ -49,4 +61,5 @@ describe "ObjectSpace._id2ref" do
|
|||||||
it 'raises RangeError when an object could not be found' do
|
it 'raises RangeError when an object could not be found' do
|
||||||
proc { ObjectSpace._id2ref(1 << 60) }.should raise_error(RangeError)
|
proc { ObjectSpace._id2ref(1 << 60) }.should raise_error(RangeError)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user