move-to-go 5.0.6 → 5.0.7

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: 91b6f9abf8f63efa4c4a49c64fa0ef214200fa78
4
- data.tar.gz: 2842fa80a9fa1719c421924aae7e0250ea48bfe6
3
+ metadata.gz: 2d2b73e2b0e9c9080ec03808579ceabc8061071b
4
+ data.tar.gz: cc02c544cae43e1537df432fab74bbf345037626
5
5
  SHA512:
6
- metadata.gz: 72b34f0e942fd720e85eebe9e9ff0cc6bf72d1396524e489e76812387405d98ec6f3174034ca6ce739be4527a357edeffa7e5664f30f2dcc55feec5ff1f9c60c
7
- data.tar.gz: adde6e214d1941b7299592517258d55a9bea6db8015b6020cc9ddbbb2ee78790e565f78b631c96acb714fd405d1159665f760cadebfee5e882f07efe47fde5d5
6
+ metadata.gz: b2fa9757d14809a3e62c748f2a987b911a0e0b00be5b218d67bc6fb3ea72e82b50d42d4282079541ac6dcda82a31ddcd171ee17384acfd1064efed7817e49cf8
7
+ data.tar.gz: 3823343232c3d45f3b1c662ac99bf838042bf07a7427418d81642d4ddf63891c26945c65691c9611321e8cc8224b0859c42e35b68a549dfb57032398ed7d9ced
@@ -50,21 +50,21 @@ module MoveToGo
50
50
  else raise
51
51
  end
52
52
  }
53
- # Find all posible duplicates and collect them to sets.
53
+ # Find all possible duplicates and collect them to sets.
54
54
  possible_duplicate_sets = self
55
- .values
56
- .group_by{ |org|
57
- fields_to_check.map{ |field|
58
- case field # Some fields (Address) are accually class objects, check what we are dealing with
59
- when Symbol then val = org.instance_variable_get(field)
60
- when Array then val = org.instance_variable_get(field[0]).instance_variable_get(field[1])
61
- end
62
- val.downcase.strip
63
- }
55
+ .values
56
+ .group_by{ |org|
57
+ fields_to_check.map{ |field|
58
+ case field # Some fields (Address) are actually class objects, check what we are dealing with
59
+ when Symbol then val = org.instance_variable_get(field)
60
+ when Array then val = org.instance_variable_get(field[0]).instance_variable_get(field[1])
61
+ end
62
+ val != nil ? val.downcase.strip : val = ''
64
63
  }
65
- .select { |k, v| v.size > 1 }
66
- .values
67
-
64
+ }
65
+ .select { |k, v| v.size > 1 }
66
+ .values
67
+
68
68
  return DuplicateSetArray.new(@rootmodel, possible_duplicate_sets)
69
69
  end
70
70
  end
@@ -205,4 +205,30 @@ describe MoveToGo::Organizations do
205
205
  org.custom_values.first.value.should eq "https"
206
206
  end
207
207
 
208
+ it "should handle if the value of a field is Nil" do
209
+ # given
210
+ model = MoveToGo::RootModel.new
211
+
212
+ organization = MoveToGo::Organization.new
213
+ organization.name = nil
214
+ organization.integration_id = "1337"
215
+ model.add_organization(organization)
216
+
217
+ (1..3).each do |n|
218
+ organization = MoveToGo::Organization.new
219
+ organization.name = "Ankeborgs bibliotek"
220
+ organization.integration_id = n.to_s
221
+ model.add_organization(organization)
222
+ end
223
+
224
+ set_to_check = []
225
+ model.organizations
226
+ .find_duplicates_by(:name)
227
+ .each do |duplicate_set|
228
+ set_to_check = duplicate_set
229
+ end
230
+ # when, the
231
+ set_to_check.length.should eq 3
232
+ end
233
+
208
234
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: move-to-go
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.6
4
+ version: 5.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Petter Sandholdt
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2017-01-03 00:00:00.000000000 Z
16
+ date: 2017-01-17 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: iso_country_codes