Sha256: e814b74e8a6e570b0052ca41a97c76205722f970a1de851ec508b33dd77cef21

Contents?: true

Size: 661 Bytes

Versions: 23

Compression:

Stored size: 661 Bytes

Contents

require 'spec_helper'

describe "#constructive_merge" do
  it "merges hashes without clobbering" do
    x = {'reviews' => {'user' => {}}}
    y = {'reviews' => {'ratings' => {}}}
    x.extend TablePrint::HashExtensions::ConstructiveMerge
    x.constructive_merge(y).should == {'reviews' => {'user' => {}, 'ratings' => {}}}
  end
end

describe "#constructive_merge!" do
  it "merges hashes in place without clobbering" do
    x = {'reviews' => {'user' => {}}}
    y = {'reviews' => {'ratings' => {}}}
    x.extend TablePrint::HashExtensions::ConstructiveMerge
    x.constructive_merge!(y)
    x.should == {'reviews' => {'user' => {}, 'ratings' => {}}}
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
table_print-1.5.7 spec/hash_extensions_spec.rb
table_print-1.5.6 spec/hash_extensions_spec.rb
table_print-1.5.5 spec/hash_extensions_spec.rb
table_print-1.5.4 spec/hash_extensions_spec.rb
table_print-1.5.3 spec/hash_extensions_spec.rb
table_print-1.5.2 spec/hash_extensions_spec.rb
table_print-1.5.1 spec/hash_extensions_spec.rb
table_print-1.5.0 spec/hash_extensions_spec.rb
table_print-1.4.1 spec/hash_extensions_spec.rb
table_print-1.4.0 spec/hash_extensions_spec.rb
table_print-1.3.3 spec/hash_extensions_spec.rb
table_print-1.3.2 spec/hash_extensions_spec.rb
table_print-1.3.1 spec/hash_extensions_spec.rb
table_print-1.3.0 spec/hash_extensions_spec.rb
table_print-1.2.0 spec/hash_extensions_spec.rb
table_print-1.1.5 spec/hash_extensions_spec.rb
table_print-1.1.4 spec/hash_extensions_spec.rb
table_print-1.1.3 spec/hash_extensions_spec.rb
table_print-1.1.2 spec/hash_extensions_spec.rb
table_print-1.1.1 spec/hash_extensions_spec.rb