Sha256: 17e6928d503263321f00a3447aeb48ae8660b2c05b22ac9b8dac372a8831b6f2

Contents?: true

Size: 961 Bytes

Versions: 8

Compression:

Stored size: 961 Bytes

Contents

require 'spec_helper'
require 'dm-core/support/ext/try_dup'

describe "try_dup" do
  it "returns a duplicate version on regular objects" do
    obj = Object.new
    oth = DataMapper::Ext.try_dup(obj)
    obj.should_not === oth
  end

  it "returns self on Numerics" do
    obj = 12
    oth = DataMapper::Ext.try_dup(obj)
    obj.should === oth
  end

  it "returns self on Symbols" do
    obj = :test
    oth = DataMapper::Ext.try_dup(obj)
    obj.should === oth
  end

  it "returns self on true" do
    obj = true
    oth = DataMapper::Ext.try_dup(obj)
    obj.should === oth
  end

  it "returns self on false" do
    obj = false
    oth = DataMapper::Ext.try_dup(obj)
    obj.should === oth
  end

  it "returns self on nil" do
    obj = nil
    oth = DataMapper::Ext.try_dup(obj)
    obj.should === oth
  end

  it "returns self on modules" do
    obj = Module.new
    oth = DataMapper::Ext.try_dup(obj)
    obj.object_id.should == oth.object_id
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
ardm-core-1.3.0 spec/unit/try_dup_spec.rb
ardm-core-1.2.1 spec/unit/try_dup_spec.rb
dm-core-1.2.1 spec/unit/try_dup_spec.rb
ghost_dm-core-1.3.0.beta spec/unit/try_dup_spec.rb
dm-core-1.2.0 spec/unit/try_dup_spec.rb
dm-core-1.2.0.rc2 spec/unit/try_dup_spec.rb
dm-core-1.2.0.rc1 spec/unit/try_dup_spec.rb
dm-core-1.1.0 spec/unit/try_dup_spec.rb