Sha256: 1b06db139c02a80ad85c6befbc31f94bfa663b8c83528028b305e8a72fb2aaa3

Contents?: true

Size: 515 Bytes

Versions: 65

Compression:

Stored size: 515 Bytes

Contents

require "spec_helper"

describe SC::HashStruct, 'deep_clone' do

  it "should deep_clone any objects that respond to deep_clone" do
    a = SC::HashStruct.new
    a[:b] = SC::HashStruct.new :c => :d

    e = a.deep_clone
    e[:b][:c] = :f

    e[:b][:c].should eql(:f)
    a[:b][:c].should eql(:d)
  end

  it "should clone any objects that respond to clone" do
    a = SC::HashStruct.new
    a[:b] = [1,2,3]

    b = a.deep_clone
    b[:b][0] = 4

    a[:b][0].should eql(1)
    b[:b][0].should eql(4)
  end

end

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
sproutcore-1.11.0 spec/lib/models/hash_struct/deep_clone_spec.rb
sproutcore-1.11.0.rc3 spec/lib/models/hash_struct/deep_clone_spec.rb
sproutcore-1.11.0.rc2 spec/lib/models/hash_struct/deep_clone_spec.rb
sproutcore-1.11.0.rc1 spec/lib/models/hash_struct/deep_clone_spec.rb
sproutcore-1.10.3.1 spec/lib/models/hash_struct/deep_clone_spec.rb
sproutcore-1.10.2 spec/lib/models/hash_struct/deep_clone_spec.rb
sproutcore-1.10.1 spec/lib/models/hash_struct/deep_clone_spec.rb
sproutcore-1.10.0 spec/lib/models/hash_struct/deep_clone_spec.rb
sproutcore-1.10.0.rc.3 spec/lib/models/hash_struct/deep_clone_spec.rb
sproutcore-1.10.0.rc.2 spec/lib/models/hash_struct/deep_clone_spec.rb
sproutcore-1.10.0.rc.1 spec/lib/models/hash_struct/deep_clone_spec.rb
sproutcore-1.9.2 spec/lib/models/hash_struct/deep_clone_spec.rb
sproutcore-1.9.1 spec/lib/models/hash_struct/deep_clone_spec.rb
sproutcore-1.9.0 spec/lib/models/hash_struct/deep_clone_spec.rb
sproutcore-1.8.2.1 spec/lib/models/hash_struct/deep_clone_spec.rb
sproutcore-1.8.1 spec/lib/models/hash_struct/deep_clone_spec.rb
sproutcore-1.8.0 spec/lib/models/hash_struct/deep_clone_spec.rb
sproutcore-1.7.1.beta-java spec/lib/models/hash_struct/deep_clone_spec.rb
sproutcore-1.7.1.beta spec/lib/models/hash_struct/deep_clone_spec.rb
sproutcore-1.6.0.1-java spec/lib/models/hash_struct/deep_clone_spec.rb