hash_dealer 1.4.5 → 1.4.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock ADDED
@@ -0,0 +1,62 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (3.1.3)
5
+ multi_json (~> 1.0)
6
+ archive-tar-minitar (0.5.2)
7
+ colorize (0.5.8)
8
+ columnize (0.3.5)
9
+ diff-lcs (1.1.3)
10
+ git (1.2.5)
11
+ guard (0.8.8)
12
+ thor (~> 0.14.6)
13
+ guard-rspec (0.4.0)
14
+ guard (>= 0.4.0)
15
+ i18n (0.6.0)
16
+ jeweler (1.6.4)
17
+ bundler (~> 1.0)
18
+ git (>= 1.2.5)
19
+ rake
20
+ linecache19 (0.5.12)
21
+ ruby_core_source (>= 0.1.4)
22
+ multi_json (1.0.3)
23
+ rake (0.9.2.2)
24
+ rcov (0.9.11)
25
+ rspec (2.7.0)
26
+ rspec-core (~> 2.7.0)
27
+ rspec-expectations (~> 2.7.0)
28
+ rspec-mocks (~> 2.7.0)
29
+ rspec-core (2.7.1)
30
+ rspec-expectations (2.7.0)
31
+ diff-lcs (~> 1.1.2)
32
+ rspec-mocks (2.7.0)
33
+ ruby-debug-base19 (0.11.25)
34
+ columnize (>= 0.3.1)
35
+ linecache19 (>= 0.5.11)
36
+ ruby_core_source (>= 0.1.4)
37
+ ruby-debug19 (0.11.6)
38
+ columnize (>= 0.3.1)
39
+ linecache19 (>= 0.5.11)
40
+ ruby-debug-base19 (>= 0.11.19)
41
+ ruby_core_source (0.1.5)
42
+ archive-tar-minitar (>= 0.5.2)
43
+ simplecov (0.5.4)
44
+ multi_json (~> 1.0.3)
45
+ simplecov-html (~> 0.5.3)
46
+ simplecov-html (0.5.3)
47
+ thor (0.14.6)
48
+
49
+ PLATFORMS
50
+ ruby
51
+
52
+ DEPENDENCIES
53
+ activesupport
54
+ bundler
55
+ colorize
56
+ guard-rspec (= 0.4.0)
57
+ i18n
58
+ jeweler
59
+ rcov
60
+ rspec
61
+ ruby-debug19
62
+ simplecov
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.5
1
+ 1.4.6
data/hash_dealer.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "hash_dealer"
8
- s.version = "1.4.5"
8
+ s.version = "1.4.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dan Langevin"]
12
- s.date = "2011-11-22"
12
+ s.date = "2011-11-25"
13
13
  s.description = "Like Factory Girl but for Hashes only"
14
14
  s.email = "dan.langevin@lifebooker.com"
15
15
  s.extra_rdoc_files = [
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
20
20
  ".document",
21
21
  ".rspec",
22
22
  "Gemfile",
23
+ "Gemfile.lock",
23
24
  "Guardfile",
24
25
  "LICENSE.txt",
25
26
  "README.rdoc",
data/lib/comparator.rb CHANGED
@@ -28,7 +28,7 @@ class Comparator
28
28
  def self.hash_diff(obj1, obj2)
29
29
  obj1, obj2 = self.stringify_keys(obj1), self.stringify_keys(obj2)
30
30
  (obj1.keys + obj2.keys).uniq.inject({}) do |memo, key|
31
- unless obj1[key] == obj2[key]
31
+ unless obj1.keys.include?(key) && obj2.keys.include?(key) && obj1[key] == obj2[key]
32
32
  if obj1[key].kind_of?(Hash) && obj2[key].kind_of?(Hash)
33
33
  memo[key] = self.diff(obj1[key],obj2[key])
34
34
  else
@@ -52,4 +52,10 @@ describe "match_response Matcher" do
52
52
  {"a" => true}.matcher.should match_response({"a" => false})
53
53
  {"a" => {"b" => false}}.matcher.should match_response({"a" => {"b" => false}})
54
54
  end
55
+
56
+ it "should return a diff when either argument is missing a key" do
57
+ Comparator.diff({"a" => true, "b" => false}, {"a" => true}).should eql({"b" => [false, nil]})
58
+ Comparator.diff({"a" => true}, {"a" => true, "b" => false}).should eql({"b" => [nil, false]})
59
+ end
60
+
55
61
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: hash_dealer
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.4.5
5
+ version: 1.4.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Dan Langevin
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-11-22 00:00:00 Z
13
+ date: 2011-11-25 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -135,6 +135,7 @@ files:
135
135
  - .document
136
136
  - .rspec
137
137
  - Gemfile
138
+ - Gemfile.lock
138
139
  - Guardfile
139
140
  - LICENSE.txt
140
141
  - README.rdoc
@@ -164,7 +165,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
164
165
  requirements:
165
166
  - - ">="
166
167
  - !ruby/object:Gem::Version
167
- hash: -4520042367006189314
168
+ hash: 4200832206885505905
168
169
  segments:
169
170
  - 0
170
171
  version: "0"