Sha256: a01ba0e951edabdb4776c0a9eab3f60ab5f1ee32ea0fe6be3b64d2532f5ef32e

Contents?: true

Size: 554 Bytes

Versions: 6

Compression:

Stored size: 554 Bytes

Contents

require 'test_helper'

class TestHash < Test::Unit::TestCase
  def test_reverse_merge
    defaults = { a: "x", b: "y", c: 10 }.freeze
    options  = { a: 1, b: 2 }
    expected = { a: 1, b: 2, c: 10 }

    # Should merge defaults into options, creating a new hash.
    assert_equal expected, options.reverse_merge(defaults)
    assert_not_equal expected, options

    # Should merge! defaults into options, replacing options.
    merged = options.dup
    assert_equal expected, merged.reverse_merge!(defaults)
    assert_equal expected, merged
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
solusvm-2.0.1.beta6 test/solusvm/test_hash.rb
solusvm-2.0.0.beta6 test/solusvm/test_hash.rb
solusvm-2.0.0.beta5 test/solusvm/test_hash.rb
solusvm-2.0.0.beta4 test/solusvm/test_hash.rb
solusvm-2.0.0.beta2 test/solusvm/test_hash.rb
solusvm-2.0.0.beta1 test/solusvm/test_hash.rb