hashdiff 0.3.7 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,75 +1,76 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
- describe HashDiff do
4
- it "should be able to find LCS between two equal array" do
5
+ describe Hashdiff do
6
+ it 'is able to find LCS between two equal array' do
5
7
  a = [1, 2, 3]
6
8
  b = [1, 2, 3]
7
9
 
8
- lcs = HashDiff.lcs(a, b)
10
+ lcs = described_class.lcs(a, b)
9
11
  lcs.should == [[0, 0], [1, 1], [2, 2]]
10
12
  end
11
13
 
12
- it "should be able to find LCS between two close arrays" do
14
+ it 'is able to find LCS between two close arrays' do
13
15
  a = [1.05, 2, 3.25]
14
16
  b = [1.06, 2, 3.24]
15
17
 
16
- lcs = HashDiff.lcs(a, b, :numeric_tolerance => 0.1)
18
+ lcs = described_class.lcs(a, b, numeric_tolerance: 0.1)
17
19
  lcs.should == [[0, 0], [1, 1], [2, 2]]
18
20
  end
19
21
 
20
- it "should strip strings when finding LCS if requested" do
21
- a = ['foo', 'bar', 'baz']
22
+ it 'strips strings when finding LCS if requested' do
23
+ a = %w[foo bar baz]
22
24
  b = [' foo', 'bar', 'zab']
23
25
 
24
- lcs = HashDiff.lcs(a, b, :strip => true)
26
+ lcs = described_class.lcs(a, b, strip: true)
25
27
  lcs.should == [[0, 0], [1, 1]]
26
28
  end
27
29
 
28
- it "should be able to find LCS with one common elements" do
30
+ it 'is able to find LCS with one common elements' do
29
31
  a = [1, 2, 3]
30
32
  b = [1, 8, 7]
31
33
 
32
- lcs = HashDiff.lcs(a, b)
34
+ lcs = described_class.lcs(a, b)
33
35
  lcs.should == [[0, 0]]
34
36
  end
35
37
 
36
- it "should be able to find LCS with two common elements" do
38
+ it 'is able to find LCS with two common elements' do
37
39
  a = [1, 3, 5, 7]
38
40
  b = [2, 3, 7, 5]
39
41
 
40
- lcs = HashDiff.lcs(a, b)
42
+ lcs = described_class.lcs(a, b)
41
43
  lcs.should == [[1, 1], [2, 3]]
42
44
  end
43
45
 
44
- it "should be able to find LCS with two close elements" do
46
+ it 'is able to find LCS with two close elements' do
45
47
  a = [1, 3.05, 5, 7]
46
48
  b = [2, 3.06, 7, 5]
47
49
 
48
- lcs = HashDiff.lcs(a, b, :numeric_tolerance => 0.1)
50
+ lcs = described_class.lcs(a, b, numeric_tolerance: 0.1)
49
51
  lcs.should == [[1, 1], [2, 3]]
50
52
  end
51
53
 
52
- it "should be able to find LCS with two common elements in different ordering" do
54
+ it 'is able to find LCS with two common elements in different ordering' do
53
55
  a = [1, 3, 4, 7]
54
56
  b = [2, 3, 7, 5]
55
57
 
56
- lcs = HashDiff.lcs(a, b)
58
+ lcs = described_class.lcs(a, b)
57
59
  lcs.should == [[1, 1], [3, 2]]
58
60
  end
59
61
 
60
- it "should be able to find LCS with a similarity value" do
62
+ it 'is able to find LCS with a similarity value' do
61
63
  a = [
62
- {"value" => "New", "onclick" => "CreateNewDoc()"},
63
- {"value" => "Close", "onclick" => "CloseDoc()"}
64
- ]
64
+ { 'value' => 'New', 'onclick' => 'CreateNewDoc()' },
65
+ { 'value' => 'Close', 'onclick' => 'CloseDoc()' }
66
+ ]
65
67
  b = [
66
- {"value" => "New1", "onclick" => "CreateNewDoc()"},
67
- {"value" => "Open", "onclick" => "OpenDoc()"},
68
- {"value" => "Close", "onclick" => "CloseDoc()"}
69
- ]
68
+ { 'value' => 'New1', 'onclick' => 'CreateNewDoc()' },
69
+ { 'value' => 'Open', 'onclick' => 'OpenDoc()' },
70
+ { 'value' => 'Close', 'onclick' => 'CloseDoc()' }
71
+ ]
70
72
 
71
- lcs = HashDiff.lcs(a, b, :similarity => 0.5)
73
+ lcs = described_class.lcs(a, b, similarity: 0.5)
72
74
  lcs.should == [[0, 0], [1, 2]]
73
75
  end
74
76
  end
75
-
@@ -1,48 +1,50 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
- describe HashDiff::LinearCompareArray do
4
- it "should find no differences between two empty arrays" do
5
+ describe Hashdiff::LinearCompareArray do
6
+ it 'finds no differences between two empty arrays' do
5
7
  difference = described_class.call([], [])
6
8
  difference.should == []
7
9
  end
8
10
 
9
- it "should find added items when the old array is empty" do
10
- difference = described_class.call([], [:a, :b])
11
+ it 'finds added items when the old array is empty' do
12
+ difference = described_class.call([], %i[a b])
11
13
  difference.should == [['+', '[0]', :a], ['+', '[1]', :b]]
12
14
  end
13
15
 
14
- it "should find removed items when the new array is empty" do
15
- difference = described_class.call([:a, :b], [])
16
+ it 'finds removed items when the new array is empty' do
17
+ difference = described_class.call(%i[a b], [])
16
18
  difference.should == [['-', '[1]', :b], ['-', '[0]', :a]]
17
19
  end
18
20
 
19
- it "should find no differences between identical arrays" do
20
- difference = described_class.call([:a, :b], [:a, :b])
21
+ it 'finds no differences between identical arrays' do
22
+ difference = described_class.call(%i[a b], %i[a b])
21
23
  difference.should == []
22
24
  end
23
25
 
24
- it "should find added items in an array" do
25
- difference = described_class.call([:a, :d], [:a, :b, :c, :d])
26
+ it 'finds added items in an array' do
27
+ difference = described_class.call(%i[a d], %i[a b c d])
26
28
  difference.should == [['+', '[1]', :b], ['+', '[2]', :c]]
27
29
  end
28
30
 
29
- it "should find removed items in an array" do
30
- difference = described_class.call([:a, :b, :c, :d, :e, :f], [:a, :d, :f])
31
+ it 'finds removed items in an array' do
32
+ difference = described_class.call(%i[a b c d e f], %i[a d f])
31
33
  difference.should == [['-', '[4]', :e], ['-', '[2]', :c], ['-', '[1]', :b]]
32
34
  end
33
35
 
34
- it "should show additions and deletions as changed items" do
35
- difference = described_class.call([:a, :b, :c], [:c, :b, :a])
36
+ it 'shows additions and deletions as changed items' do
37
+ difference = described_class.call(%i[a b c], %i[c b a])
36
38
  difference.should == [['~', '[0]', :a, :c], ['~', '[2]', :c, :a]]
37
39
  end
38
40
 
39
- it "should show changed items in a hash" do
40
- difference = described_class.call([{ :a => :b }], [{ :a => :c }])
41
+ it 'shows changed items in a hash' do
42
+ difference = described_class.call([{ a: :b }], [{ a: :c }])
41
43
  difference.should == [['~', '[0].a', :b, :c]]
42
44
  end
43
45
 
44
- it "should show changed items and added items" do
45
- difference = described_class.call([{ :a => 1, :b => 2 }], [{ :a => 2, :b => 2 }, :item])
46
+ it 'shows changed items and added items' do
47
+ difference = described_class.call([{ a: 1, b: 2 }], [{ a: 2, b: 2 }, :item])
46
48
  difference.should == [['~', '[0].a', 1, 2], ['+', '[1]', :item]]
47
49
  end
48
50
  end
@@ -1,183 +1,185 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
- describe HashDiff do
4
- it "it should be able to patch key addition" do
5
- a = {"a"=>3, "c"=>11, "d"=>45, "e"=>100, "f"=>200}
6
- b = {"a"=>3, "c"=>11, "d"=>45, "e"=>100, "f"=>200, "g"=>300}
7
- diff = HashDiff.diff(a, b)
5
+ describe Hashdiff do
6
+ it 'is able to patch key addition' do
7
+ a = { 'a' => 3, 'c' => 11, 'd' => 45, 'e' => 100, 'f' => 200 }
8
+ b = { 'a' => 3, 'c' => 11, 'd' => 45, 'e' => 100, 'f' => 200, 'g' => 300 }
9
+ diff = described_class.diff(a, b)
8
10
 
9
- HashDiff.patch!(a, diff).should == b
11
+ expect(described_class.patch!(a, diff)).to eq(b)
10
12
 
11
- a = {"a"=>3, "c"=>11, "d"=>45, "e"=>100, "f"=>200}
12
- b = {"a"=>3, "c"=>11, "d"=>45, "e"=>100, "f"=>200, "g"=>300}
13
- HashDiff.unpatch!(b, diff).should == a
13
+ a = { 'a' => 3, 'c' => 11, 'd' => 45, 'e' => 100, 'f' => 200 }
14
+ b = { 'a' => 3, 'c' => 11, 'd' => 45, 'e' => 100, 'f' => 200, 'g' => 300 }
15
+ described_class.unpatch!(b, diff).should == a
14
16
  end
15
17
 
16
- it "should be able to patch value type changes" do
17
- a = {"a" => 3}
18
- b = {"a" => {"a1" => 1, "a2" => 2}}
19
- diff = HashDiff.diff(a, b)
18
+ it 'is able to patch value type changes' do
19
+ a = { 'a' => 3 }
20
+ b = { 'a' => { 'a1' => 1, 'a2' => 2 } }
21
+ diff = described_class.diff(a, b)
20
22
 
21
- HashDiff.patch!(a, diff).should == b
23
+ expect(described_class.patch!(a, diff)).to eq(b)
22
24
 
23
- a = {"a" => 3}
24
- b = {"a" => {"a1" => 1, "a2" => 2}}
25
- HashDiff.unpatch!(b, diff).should == a
25
+ a = { 'a' => 3 }
26
+ b = { 'a' => { 'a1' => 1, 'a2' => 2 } }
27
+ described_class.unpatch!(b, diff).should == a
26
28
  end
27
29
 
28
- it "should be able to patch value array <=> []" do
29
- a = {"a" => 1, "b" => [1, 2]}
30
- b = {"a" => 1, "b" => []}
31
- diff = HashDiff.diff(a, b)
30
+ it 'is able to patch value array <=> []' do
31
+ a = { 'a' => 1, 'b' => [1, 2] }
32
+ b = { 'a' => 1, 'b' => [] }
33
+ diff = described_class.diff(a, b)
32
34
 
33
- HashDiff.patch!(a, diff).should == b
35
+ expect(described_class.patch!(a, diff)).to eq(b)
34
36
 
35
- a = {"a" => 1, "b" => [1, 2]}
36
- b = {"a" => 1, "b" => []}
37
- HashDiff.unpatch!(b, diff).should == a
37
+ a = { 'a' => 1, 'b' => [1, 2] }
38
+ b = { 'a' => 1, 'b' => [] }
39
+ described_class.unpatch!(b, diff).should == a
38
40
  end
39
41
 
40
- it "should be able to patch value array <=> nil" do
41
- a = {"a" => 1, "b" => [1, 2]}
42
- b = {"a" => 1, "b" => nil}
43
- diff = HashDiff.diff(a, b)
42
+ it 'is able to patch value array <=> nil' do
43
+ a = { 'a' => 1, 'b' => [1, 2] }
44
+ b = { 'a' => 1, 'b' => nil }
45
+ diff = described_class.diff(a, b)
44
46
 
45
- HashDiff.patch!(a, diff).should == b
47
+ expect(described_class.patch!(a, diff)).to eq(b)
46
48
 
47
- a = {"a" => 1, "b" => [1, 2]}
48
- b = {"a" => 1, "b" => nil}
49
- HashDiff.unpatch!(b, diff).should == a
49
+ a = { 'a' => 1, 'b' => [1, 2] }
50
+ b = { 'a' => 1, 'b' => nil }
51
+ described_class.unpatch!(b, diff).should == a
50
52
  end
51
53
 
52
- it "should be able to patch array value removal" do
53
- a = {"a" => 1, "b" => [1, 2]}
54
- b = {"a" => 1}
55
- diff = HashDiff.diff(a, b)
54
+ it 'is able to patch array value removal' do
55
+ a = { 'a' => 1, 'b' => [1, 2] }
56
+ b = { 'a' => 1 }
57
+ diff = described_class.diff(a, b)
56
58
 
57
- HashDiff.patch!(a, diff).should == b
59
+ expect(described_class.patch!(a, diff)).to eq(b)
58
60
 
59
- a = {"a" => 1, "b" => [1, 2]}
60
- b = {"a" => 1}
61
- HashDiff.unpatch!(b, diff).should == a
61
+ a = { 'a' => 1, 'b' => [1, 2] }
62
+ b = { 'a' => 1 }
63
+ described_class.unpatch!(b, diff).should == a
62
64
  end
63
65
 
64
- it "should be able to patch array under hash key with non-word characters" do
65
- a = {"a" => 1, "b-b" => [1, 2]}
66
- b = {"a" => 1, "b-b" => [2, 1]}
67
- diff = HashDiff.diff(a, b)
66
+ it 'is able to patch array under hash key with non-word characters' do
67
+ a = { 'a' => 1, 'b-b' => [1, 2] }
68
+ b = { 'a' => 1, 'b-b' => [2, 1] }
69
+ diff = described_class.diff(a, b)
68
70
 
69
- HashDiff.patch!(a, diff).should == b
71
+ expect(described_class.patch!(a, diff)).to eq(b)
70
72
 
71
- a = {"a" => 1, "b-b" => [1, 2]}
72
- b = {"a" => 1, "b-b" => [2, 1]}
73
- HashDiff.unpatch!(b, diff).should == a
73
+ a = { 'a' => 1, 'b-b' => [1, 2] }
74
+ b = { 'a' => 1, 'b-b' => [2, 1] }
75
+ described_class.unpatch!(b, diff).should == a
74
76
  end
75
77
 
76
- it "should be able to patch hash value removal" do
77
- a = {"a" => 1, "b" => {"b1" => 1, "b2" =>2}}
78
- b = {"a" => 1}
79
- diff = HashDiff.diff(a, b)
78
+ it 'is able to patch hash value removal' do
79
+ a = { 'a' => 1, 'b' => { 'b1' => 1, 'b2' => 2 } }
80
+ b = { 'a' => 1 }
81
+ diff = described_class.diff(a, b)
80
82
 
81
- HashDiff.patch!(a, diff).should == b
83
+ expect(described_class.patch!(a, diff)).to eq(b)
82
84
 
83
- a = {"a" => 1, "b" => {"b1" => 1, "b2" =>2}}
84
- b = {"a" => 1}
85
- HashDiff.unpatch!(b, diff).should == a
85
+ a = { 'a' => 1, 'b' => { 'b1' => 1, 'b2' => 2 } }
86
+ b = { 'a' => 1 }
87
+ described_class.unpatch!(b, diff).should == a
86
88
  end
87
89
 
88
- it "should be able to patch value hash <=> {}" do
89
- a = {"a" => 1, "b" => {"b1" => 1, "b2" =>2}}
90
- b = {"a" => 1, "b" => {}}
91
- diff = HashDiff.diff(a, b)
90
+ it 'is able to patch value hash <=> {}' do
91
+ a = { 'a' => 1, 'b' => { 'b1' => 1, 'b2' => 2 } }
92
+ b = { 'a' => 1, 'b' => {} }
93
+ diff = described_class.diff(a, b)
92
94
 
93
- HashDiff.patch!(a, diff).should == b
95
+ expect(described_class.patch!(a, diff)).to eq(b)
94
96
 
95
- a = {"a" => 1, "b" => {"b1" => 1, "b2" =>2}}
96
- b = {"a" => 1, "b" => {}}
97
- HashDiff.unpatch!(b, diff).should == a
97
+ a = { 'a' => 1, 'b' => { 'b1' => 1, 'b2' => 2 } }
98
+ b = { 'a' => 1, 'b' => {} }
99
+ described_class.unpatch!(b, diff).should == a
98
100
  end
99
101
 
100
- it "should be able to patch value hash <=> nil" do
101
- a = {"a" => 1, "b" => {"b1" => 1, "b2" =>2}}
102
- b = {"a" => 1, "b" => nil}
103
- diff = HashDiff.diff(a, b)
102
+ it 'is able to patch value hash <=> nil' do
103
+ a = { 'a' => 1, 'b' => { 'b1' => 1, 'b2' => 2 } }
104
+ b = { 'a' => 1, 'b' => nil }
105
+ diff = described_class.diff(a, b)
104
106
 
105
- HashDiff.patch!(a, diff).should == b
107
+ expect(described_class.patch!(a, diff)).to eq(b)
106
108
 
107
- a = {"a" => 1, "b" => {"b1" => 1, "b2" =>2}}
108
- b = {"a" => 1, "b" => nil}
109
- HashDiff.unpatch!(b, diff).should == a
109
+ a = { 'a' => 1, 'b' => { 'b1' => 1, 'b2' => 2 } }
110
+ b = { 'a' => 1, 'b' => nil }
111
+ described_class.unpatch!(b, diff).should == a
110
112
  end
111
113
 
112
- it "should be able to patch value nil removal" do
113
- a = {"a" => 1, "b" => nil}
114
- b = {"a" => 1}
115
- diff = HashDiff.diff(a, b)
114
+ it 'is able to patch value nil removal' do
115
+ a = { 'a' => 1, 'b' => nil }
116
+ b = { 'a' => 1 }
117
+ diff = described_class.diff(a, b)
116
118
 
117
- HashDiff.patch!(a, diff).should == b
119
+ expect(described_class.patch!(a, diff)).to eq(b)
118
120
 
119
- a = {"a" => 1, "b" => nil}
120
- b = {"a" => 1}
121
- HashDiff.unpatch!(b, diff).should == a
121
+ a = { 'a' => 1, 'b' => nil }
122
+ b = { 'a' => 1 }
123
+ described_class.unpatch!(b, diff).should == a
122
124
  end
123
125
 
124
- it "should be able to patch similar objects between arrays" do
125
- a = [{'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5}, 3]
126
- b = [1, {'a' => 1, 'b' => 2, 'c' => 3, 'e' => 5}]
126
+ it 'is able to patch similar objects between arrays' do
127
+ a = [{ 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5 }, 3]
128
+ b = [1, { 'a' => 1, 'b' => 2, 'c' => 3, 'e' => 5 }]
127
129
 
128
- diff = HashDiff.diff(a, b)
129
- HashDiff.patch!(a, diff).should == b
130
+ diff = described_class.diff(a, b)
131
+ expect(described_class.patch!(a, diff)).to eq(b)
130
132
 
131
- a = [{'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5}, 3]
132
- b = [1, {'a' => 1, 'b' => 2, 'c' => 3, 'e' => 5}]
133
- HashDiff.unpatch!(b, diff).should == a
133
+ a = [{ 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5 }, 3]
134
+ b = [1, { 'a' => 1, 'b' => 2, 'c' => 3, 'e' => 5 }]
135
+ described_class.unpatch!(b, diff).should == a
134
136
  end
135
137
 
136
- it "should be able to patch similar & equal objects between arrays" do
137
- a = [{'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5}, {'x' => 5, 'y' => 6, 'z' => 3}, 1]
138
- b = [1, {'a' => 1, 'b' => 2, 'c' => 3, 'e' => 5}]
138
+ it 'is able to patch similar & equal objects between arrays' do
139
+ a = [{ 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5 }, { 'x' => 5, 'y' => 6, 'z' => 3 }, 1]
140
+ b = [1, { 'a' => 1, 'b' => 2, 'c' => 3, 'e' => 5 }]
139
141
 
140
- diff = HashDiff.diff(a, b)
141
- HashDiff.patch!(a, diff).should == b
142
+ diff = described_class.diff(a, b)
143
+ expect(described_class.patch!(a, diff)).to eq(b)
142
144
 
143
- a = [{'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5}, {'x' => 5, 'y' => 6, 'z' => 3}, 1]
144
- b = [1, {'a' => 1, 'b' => 2, 'c' => 3, 'e' => 5}]
145
- HashDiff.unpatch!(b, diff).should == a
145
+ a = [{ 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5 }, { 'x' => 5, 'y' => 6, 'z' => 3 }, 1]
146
+ b = [1, { 'a' => 1, 'b' => 2, 'c' => 3, 'e' => 5 }]
147
+ described_class.unpatch!(b, diff).should == a
146
148
  end
147
149
 
148
- it "should be able to patch hash value removal with custom delimiter" do
149
- a = {"a" => 1, "b" => {"b1" => 1, "b2" =>2}}
150
- b = {"a" => 1, "b" => {"b1" => 3} }
151
- diff = HashDiff.diff(a, b, :delimiter => "\n")
150
+ it 'is able to patch hash value removal with custom delimiter' do
151
+ a = { 'a' => 1, 'b' => { 'b1' => 1, 'b2' => 2 } }
152
+ b = { 'a' => 1, 'b' => { 'b1' => 3 } }
153
+ diff = described_class.diff(a, b, delimiter: "\n")
152
154
 
153
- HashDiff.patch!(a, diff, :delimiter => "\n").should == b
155
+ expect(described_class.patch!(a, diff, delimiter: "\n")).to eq(b)
154
156
 
155
- a = {"a" => 1, "b" => {"b1" => 1, "b2" =>2}}
156
- b = {"a" => 1, "b" => {"b1" => 3} }
157
- HashDiff.unpatch!(b, diff, :delimiter => "\n").should == a
157
+ a = { 'a' => 1, 'b' => { 'b1' => 1, 'b2' => 2 } }
158
+ b = { 'a' => 1, 'b' => { 'b1' => 3 } }
159
+ described_class.unpatch!(b, diff, delimiter: "\n").should == a
158
160
  end
159
161
 
160
- it "should be able to patch when the diff is generated with an array_path" do
161
- a = {"a" => 1, "b" => 1}
162
- b = {"a" => 1, "b" => 2}
163
- diff = HashDiff.diff(a, b, :array_path => true)
162
+ it 'is able to patch when the diff is generated with an array_path' do
163
+ a = { 'a' => 1, 'b' => 1 }
164
+ b = { 'a' => 1, 'b' => 2 }
165
+ diff = described_class.diff(a, b, array_path: true)
164
166
 
165
- HashDiff.patch!(a, diff).should == b
167
+ expect(described_class.patch!(a, diff)).to eq(b)
166
168
 
167
- a = {"a" => 1, "b" => 1}
168
- b = {"a" => 1, "b" => 2}
169
- HashDiff.unpatch!(b, diff).should == a
169
+ a = { 'a' => 1, 'b' => 1 }
170
+ b = { 'a' => 1, 'b' => 2 }
171
+ described_class.unpatch!(b, diff).should == a
170
172
  end
171
173
 
172
- it "should be able to use non string keys when diff is generated with an array_path" do
173
- a = {"a" => 1, :a => 2, 0 => 3}
174
- b = {"a" => 5, :a => 6, 0 => 7}
175
- diff = HashDiff.diff(a, b, :array_path => true)
174
+ it 'is able to use non string keys when diff is generated with an array_path' do
175
+ a = { 'a' => 1, :a => 2, 0 => 3 }
176
+ b = { 'a' => 5, :a => 6, 0 => 7 }
177
+ diff = described_class.diff(a, b, array_path: true)
176
178
 
177
- HashDiff.patch!(a, diff).should == b
179
+ expect(described_class.patch!(a, diff)).to eq(b)
178
180
 
179
- a = {"a" => 1, :a => 2, 0 => 3}
180
- b = {"a" => 5, :a => 6, 0 => 7}
181
- HashDiff.unpatch!(b, diff).should == a
181
+ a = { 'a' => 1, :a => 2, 0 => 3 }
182
+ b = { 'a' => 5, :a => 6, 0 => 7 }
183
+ described_class.unpatch!(b, diff).should == a
182
184
  end
183
185
  end