1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
require 'spec_helper'
require 'extlib/try_dup'
describe "try_dup" do
it "returns a duplicate version on regular objects" do
obj = Object.new
oth = obj.try_dup
obj.should_not === oth
end
it "returns self on Numerics" do
obj = 12
oth = obj.try_dup
obj.should === oth
end
it "returns self on Symbols" do
obj = :test
oth = obj.try_dup
obj.should === oth
end
it "returns self on true" do
obj = true
oth = obj.try_dup
obj.should === oth
end
it "returns self on false" do
obj = false
oth = obj.try_dup
obj.should === oth
end
it "returns self on nil" do
obj = nil
oth = obj.try_dup
obj.should === oth
end
it "returns self on modules" do
obj = Module.new
oth = obj.try_dup
obj.object_id.should == oth.object_id
end
end
|