hash_diff 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb76aa783f3ab7baa94d421ec41ee9aaaa0f0667
4
- data.tar.gz: f78a355f2295e7eda184b78c6ccb6b69480b013d
3
+ metadata.gz: ab2e595d5da98e49d516f5d7155b719b44ca7761
4
+ data.tar.gz: e6cff1864bb75c22da07fb640ee9a63488f91b66
5
5
  SHA512:
6
- metadata.gz: 02732e740269c1bb657423dbd72cb4c2ddefd461e6ae58abc96ded2782325e67f0f8a48580af426b0b31181ecda75c073cb591c36b1012fe0a8202ec50709114
7
- data.tar.gz: c9c842430b4b1543eb062b0cb571c2757d79970b85bae1937c19c8258d744b095e969d71e0d4f3dc65bc85562b0b587e9d3d28a34d00b01fd1d52ed7f3ee3ac3
6
+ metadata.gz: a1535bd251d67c22d92f7a481a2ed747607d8af0190ec33d1f1d7e5d56d631f62368c5c2e06a4bd2ed21818532959d9df7815bb696b7d0cd9a32ead546d43871
7
+ data.tar.gz: 204f6d43919ebc83820be81790251790787238940e16e90b3ca4eade052a576234134dc67e6993ec4494636a4f6b555e5316e70b8989c484342db9494818a260
data/README.md CHANGED
@@ -90,6 +90,15 @@ Hash#diff is not provided by default, and monkey patching is frowned upon by som
90
90
  left.diff(right) # => { foo: 'baz' }
91
91
  ```
92
92
 
93
+ ## Credits
94
+
95
+ Authored by Adam Cuppy (@acuppy) of Coding ZEAL (http://codingzeal.com)
96
+
97
+ ![Coding ZEAL](https://googledrive.com/host/0B3TWa6M1MsWeWmxRZWhscllwTzA/ZEAL-logo-final-150.png)
98
+
99
+ This is freely distributed under the MIT license. Use it, modify it,
100
+ enjoy :)
101
+
93
102
  ## Contributing
94
103
 
95
104
  1. Fork it
@@ -20,5 +20,5 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
- spec.add_development_dependency "rspec", "~> 2.6.0"
23
+ spec.add_development_dependency "rspec", "~> 3.1"
24
24
  end
@@ -1,3 +1,3 @@
1
1
  module HashDiff
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  end
@@ -5,28 +5,29 @@ describe HashDiff::Comparison do
5
5
  let(:app_v1_properties) { { foo: 'bar', bar: 'foo', nested: { foo: 'bar', bar: { one: 'foo1' } }, num: 1 } }
6
6
  let(:app_v2_properties) { { foo: 'bar2', bar: 'foo2', nested: { foo: 'bar2', bar: { two: 'foo2' } }, word: 'monkey' } }
7
7
 
8
- subject { HashDiff::Comparison.new(app_v1_properties, app_v2_properties) }
8
+ subject(:comparison) { HashDiff::Comparison.new(app_v1_properties, app_v2_properties) }
9
9
 
10
10
  describe "#diff" do
11
+ subject { comparison.diff }
11
12
 
12
13
  context "when different" do
13
- let(:diff) {
14
+ let(:diff) {
14
15
  {
15
- foo: ["bar", "bar2"],
16
- bar: ["foo", "foo2"],
16
+ foo: ["bar", "bar2"],
17
+ bar: ["foo", "foo2"],
17
18
  nested: {
18
- foo: ["bar", "bar2"],
19
+ foo: ["bar", "bar2"],
19
20
  bar: {
20
- one: ["foo1", nil],
21
+ one: ["foo1", nil],
21
22
  two: [nil, "foo2"]
22
23
  }
23
24
  },
24
- num: [1, nil],
25
+ num: [1, nil],
25
26
  word: [nil, "monkey"]
26
27
  }
27
28
  }
28
29
 
29
- its(:diff) { should == diff }
30
+ it { expect(subject).to eq diff }
30
31
  end
31
32
 
32
33
  context "when similar" do
@@ -35,54 +36,58 @@ describe HashDiff::Comparison do
35
36
  context "in the same order" do
36
37
  let(:app_v2_properties) { app_v1_properties }
37
38
 
38
- its(:diff) { should be_empty }
39
+ it { expect(subject).to be_empty }
39
40
  end
40
41
 
41
42
  context "in a different order" do
42
43
  let(:app_v2_properties) { { bar: 'foo', foo: 'bar' } }
43
44
 
44
- its(:diff) { should be_empty }
45
+ it { expect(subject).to be_empty }
45
46
  end
46
47
  end
47
48
  end
48
49
 
49
50
  describe "#left_diff" do
50
- let(:diff) {
51
+ subject { comparison.left_diff }
52
+
53
+ let(:diff) {
51
54
  {
52
- foo: "bar2",
53
- bar: "foo2",
55
+ foo: "bar2",
56
+ bar: "foo2",
54
57
  nested: {
55
- foo: "bar2",
58
+ foo: "bar2",
56
59
  bar: {
57
- one: nil,
60
+ one: nil,
58
61
  two: "foo2"
59
62
  }
60
63
  },
61
- num: nil,
64
+ num: nil,
62
65
  word: "monkey"
63
66
  }
64
67
  }
65
68
 
66
- its(:left_diff) { should == diff }
69
+ it { expect(subject).to eq diff }
67
70
  end
68
71
 
69
72
  describe "#right_diff" do
70
- let(:diff) {
73
+ subject { comparison.right_diff }
74
+
75
+ let(:diff) {
71
76
  {
72
- foo: "bar",
73
- bar: "foo",
77
+ foo: "bar",
78
+ bar: "foo",
74
79
  nested: {
75
- foo: "bar",
80
+ foo: "bar",
76
81
  bar: {
77
- one: "foo1",
82
+ one: "foo1",
78
83
  two: nil
79
84
  }
80
85
  },
81
- num: 1,
86
+ num: 1,
82
87
  word: nil
83
88
  }
84
89
  }
85
90
 
86
- its(:right_diff) { should == diff }
91
+ it { expect(subject).to eq diff }
87
92
  end
88
- end
93
+ end
@@ -2,38 +2,41 @@ require "spec_helper"
2
2
 
3
3
  describe HashDiff do
4
4
  describe ".diff" do
5
- let(:comparison) { double("comparison") }
6
- let(:left) { double("left") }
7
- let(:right) { double("right") }
8
-
9
- it "delegates to Comparison#diff" do
10
- HashDiff::Comparison.should_receive(:new).with(left, right).and_return(comparison)
11
- comparison.should_receive(:diff)
12
- HashDiff.diff(left, right)
13
- end
5
+ subject { described_class.diff left, right }
6
+
7
+ let(:left) {
8
+ { foo: "bar" }
9
+ }
10
+ let(:right) {
11
+ { foo: "bar2" }
12
+ }
13
+
14
+ it { expect(subject).to eq({ foo: ['bar', 'bar2']}) }
14
15
  end
15
16
 
16
17
  describe ".left_diff" do
17
- let(:comparison) { double("comparison") }
18
- let(:left) { double("left") }
19
- let(:right) { double("right") }
20
-
21
- it "delegates to Comparison#left_diff" do
22
- HashDiff::Comparison.should_receive(:new).with(left, right).and_return(comparison)
23
- comparison.should_receive(:left_diff)
24
- HashDiff.left_diff(left, right)
25
- end
18
+ subject { described_class.left_diff left, right }
19
+
20
+ let(:left) {
21
+ { foo: "bar" }
22
+ }
23
+ let(:right) {
24
+ { foo: "bar2" }
25
+ }
26
+
27
+ it { expect(subject).to eq({ foo: 'bar2' }) }
26
28
  end
27
29
 
28
30
  describe ".right_diff" do
29
- let(:comparison) { double("comparison") }
30
- let(:left) { double("left") }
31
- let(:right) { double("right") }
32
-
33
- it "delegates to Comparison#right_diff" do
34
- HashDiff::Comparison.should_receive(:new).with(left, right).and_return(comparison)
35
- comparison.should_receive(:right_diff)
36
- HashDiff.right_diff(left, right)
37
- end
31
+ subject { described_class.right_diff left, right }
32
+
33
+ let(:left) {
34
+ { foo: "bar" }
35
+ }
36
+ let(:right) {
37
+ { foo: "bar2" }
38
+ }
39
+
40
+ it { expect(subject).to eq({ foo: 'bar' }) }
38
41
  end
39
- end
42
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hash_diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coding Zeal
@@ -9,50 +9,50 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-12 00:00:00.000000000 Z
12
+ date: 2015-06-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.3'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.3'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: 2.6.0
48
+ version: '3.1'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: 2.6.0
55
+ version: '3.1'
56
56
  description: Diff tool for deep Ruby hash comparison
57
57
  email:
58
58
  - info@codingzeal.com
@@ -60,8 +60,8 @@ executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - .gitignore
64
- - .travis.yml
63
+ - ".gitignore"
64
+ - ".travis.yml"
65
65
  - Gemfile
66
66
  - LICENSE.txt
67
67
  - README.md
@@ -83,17 +83,17 @@ require_paths:
83
83
  - lib
84
84
  required_ruby_version: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - '>='
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  requirements:
91
- - - '>='
91
+ - - ">="
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  requirements: []
95
95
  rubyforge_project:
96
- rubygems_version: 2.0.14
96
+ rubygems_version: 2.2.2
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: Deep Ruby Hash comparison
@@ -101,3 +101,4 @@ test_files:
101
101
  - spec/hash_diff/comparison_spec.rb
102
102
  - spec/hash_diff_spec.rb
103
103
  - spec/spec_helper.rb
104
+ has_rdoc: