|
|
8a86a4 |
diff -uNr deep_merge-1.0.1.ORIG/deep_merge.gemspec deep_merge-1.0.1/deep_merge.gemspec
|
|
|
8a86a4 |
--- deep_merge-1.0.1.ORIG/deep_merge.gemspec 2014-05-30 13:15:45.024000000 +0000
|
|
|
8a86a4 |
+++ deep_merge-1.0.1/deep_merge.gemspec 2014-05-30 13:18:42.221000000 +0000
|
|
|
8a86a4 |
@@ -30,5 +30,6 @@
|
|
|
8a86a4 |
else
|
|
|
8a86a4 |
s.add_dependency(%q<rake>, ["~> 10.1"])
|
|
|
8a86a4 |
end
|
|
|
8a86a4 |
+ s.add_development_dependency "minitest"
|
|
|
8a86a4 |
end
|
|
|
8a86a4 |
|
|
|
8a86a4 |
diff -uNr deep_merge-1.0.1.ORIG/test/test_deep_merge.rb deep_merge-1.0.1/test/test_deep_merge.rb
|
|
|
8a86a4 |
--- deep_merge-1.0.1.ORIG/test/test_deep_merge.rb 2014-05-30 13:15:45.024000000 +0000
|
|
|
8a86a4 |
+++ deep_merge-1.0.1/test/test_deep_merge.rb 2014-05-30 13:21:27.440000000 +0000
|
|
|
8a86a4 |
@@ -1,4 +1,4 @@
|
|
|
8a86a4 |
-require 'test/unit'
|
|
|
8a86a4 |
+require 'minitest/autorun'
|
|
|
8a86a4 |
|
|
|
8a86a4 |
$:.unshift(File.dirname(__FILE__) + '/../lib/')
|
|
|
8a86a4 |
require 'deep_merge'
|
|
|
8a86a4 |
@@ -11,7 +11,7 @@
|
|
|
8a86a4 |
end
|
|
|
8a86a4 |
end
|
|
|
8a86a4 |
|
|
|
8a86a4 |
-class TestDeepMerge < Test::Unit::TestCase
|
|
|
8a86a4 |
+class TestDeepMerge < Minitest::Test
|
|
|
8a86a4 |
|
|
|
8a86a4 |
def setup
|
|
|
8a86a4 |
end
|
|
|
8a86a4 |
@@ -214,12 +214,13 @@
|
|
|
8a86a4 |
assert_equal({"property" => {"bedroom_count" => {"king_bed" => [nil, 3], "queen_bed" => [4, nil, 1]}, "bathroom_count" => [nil, "2", "1"]}}, hash_dst)
|
|
|
8a86a4 |
|
|
|
8a86a4 |
# test parameter management for knockout_prefix and overwrite unmergable
|
|
|
8a86a4 |
- assert_raise(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => ""})}
|
|
|
8a86a4 |
- assert_raise(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true, :knockout_prefix => ""})}
|
|
|
8a86a4 |
- assert_raise(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true, :knockout_prefix => "--"})}
|
|
|
8a86a4 |
- assert_nothing_raised(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => "--"})}
|
|
|
8a86a4 |
- assert_nothing_raised(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst)}
|
|
|
8a86a4 |
- assert_nothing_raised(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true})}
|
|
|
8a86a4 |
+ assert_raises(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => ""})}
|
|
|
8a86a4 |
+ assert_raises(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true, :knockout_prefix => ""})}
|
|
|
8a86a4 |
+ assert_raises(DeepMerge::InvalidParameter) {DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true, :knockout_prefix => "--"})}
|
|
|
8a86a4 |
+ # test valid parameters
|
|
|
8a86a4 |
+ DeepMerge::deep_merge!(hash_src, hash_dst, {:knockout_prefix => "--"})
|
|
|
8a86a4 |
+ DeepMerge::deep_merge!(hash_src, hash_dst)
|
|
|
8a86a4 |
+ DeepMerge::deep_merge!(hash_src, hash_dst, {:preserve_unmergeables => true})
|
|
|
8a86a4 |
|
|
|
8a86a4 |
# hash holding arrays of arrays
|
|
|
8a86a4 |
hash_src = {["1", "2", "3"] => ["1", "2"]}
|