Sha256: b0eb4b5573127ff0adb643750e3f6b9fb0b2b308005ed067c9f33dfdedfd29d6

Contents?: true

Size: 866 Bytes

Versions: 9

Compression:

Stored size: 866 Bytes

Contents

require File.dirname(__FILE__)+'/../spec_helper'
require 'gorillib/object/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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gorillib-0.1.7 spec/object/try_dup_spec.rb
gorillib-0.1.6 spec/object/try_dup_spec.rb
gorillib-0.1.5 spec/object/try_dup_spec.rb
gorillib-0.1.4 spec/object/try_dup_spec.rb
gorillib-0.1.3 spec/object/try_dup_spec.rb
gorillib-0.1.2 spec/object/try_dup_spec.rb
gorillib-0.1.1 spec/object/try_dup_spec.rb
gorillib-0.1.0 spec/object/try_dup_spec.rb
gorillib-0.0.8 spec/object/try_dup_spec.rb