Sha256: c31e72fd79d14bb47ffcdd8b32617cd8a579ae2f7fc33d5942601735a8a312a2

Contents?: true

Size: 883 Bytes

Versions: 3

Compression:

Stored size: 883 Bytes

Contents

require File.expand_path('../spec_helper', File.dirname(__FILE__))
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

3 entries across 3 versions & 1 rubygems

Version Path
gorillib-0.1.11 spec/object/try_dup_spec.rb
gorillib-0.1.9 spec/object/try_dup_spec.rb
gorillib-0.1.8 spec/object/try_dup_spec.rb