Sha256: 6a20b6c5810ec74d5a819851a28c1b361e229922620ed1bb274f82697e8a4518

Contents?: true

Size: 826 Bytes

Versions: 2

Compression:

Stored size: 826 Bytes

Contents

require 'spec_helper'

describe 'try_dup', :simple_spec => true 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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gorillib-model-0.0.3 spec/core_ext/object.rb
gorillib-model-0.0.1 spec/core_ext/object.rb