move-to-go 5.0.4 → 5.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c24f07f103ba93494bf92b7abbe1e68690e6421
4
- data.tar.gz: 8299844ac4c5bb1045937ad10d4302c1ae2c5f23
3
+ metadata.gz: 91b6f9abf8f63efa4c4a49c64fa0ef214200fa78
4
+ data.tar.gz: 2842fa80a9fa1719c421924aae7e0250ea48bfe6
5
5
  SHA512:
6
- metadata.gz: 3567f1361e0527c9282d9fc092249e4ca4d6575abbb6a28665a1c3bb7a3d53d63a56c2fcc197a965b3d9bca679469d65e47b6f14e6dfa8830cdd8f080e3c75b2
7
- data.tar.gz: 79cce7943560bbb9df1266dc566b064b23e009baee749eaf7cb55dc4e49d279dc73f9bc2091e3b824c65912beedb16e2235d896622203c21e627e4cd94987987
6
+ metadata.gz: 72b34f0e942fd720e85eebe9e9ff0cc6bf72d1396524e489e76812387405d98ec6f3174034ca6ce739be4527a357edeffa7e5664f30f2dcc55feec5ff1f9c60c
7
+ data.tar.gz: adde6e214d1941b7299592517258d55a9bea6db8015b6020cc9ddbbb2ee78790e565f78b631c96acb714fd405d1159665f760cadebfee5e882f07efe47fde5d5
data/bin/move-to-go CHANGED
@@ -106,6 +106,10 @@ class MoveToGoCommandLine < Thor
106
106
  end
107
107
  model.report_rootmodel_status()
108
108
 
109
+ puts "Checking for duplicate organizations..."
110
+ possible_duplicates = model.organizations.find_duplicates_by(:name, :organization_number)
111
+ puts "Found #{possible_duplicates.length} organization duplicate sets in rootmodel, based on name and organization number"
112
+
109
113
  puts "Starting sharding of model..."
110
114
  sharder = MoveToGo::ShardHelper.new(options.shard_size)
111
115
  models_to_serialize = sharder.shard_model(model)
@@ -114,34 +114,41 @@ module MoveToGo
114
114
  end
115
115
 
116
116
  def validate(labels = nil)
117
- error = String.new
118
- warnings = String.new
117
+ errors = []
118
+ warnings = []
119
119
 
120
120
  if @name.nil? || @name.empty?
121
- error = "A name is required for deal.\n"
121
+ errors.push("A name is required for deal.")
122
122
  end
123
123
 
124
124
  if is_integer?(@value) && @value.to_i < 0
125
- error = "The value must be positive for deal.\n"
125
+ errors.push("The value must be positive for deal.")
126
126
  end
127
127
 
128
128
  if !@status.nil? && @status.status_reference.nil?
129
- error = "#{error}\nStatus must have a status reference."
129
+ errors.push("Status must have a status reference.")
130
130
  end
131
131
 
132
132
  if !@status.nil? && !@status.status_reference.nil? && @status.status_reference.validate.length > 0
133
- error = "#{error}\n#{@status.status_reference.validate}"
133
+ val = @status.status_reference.validate
134
+ if val.length > 0
135
+ errors.push(val)
136
+ end
134
137
  end
135
138
 
136
139
  if !@status.nil? && !@status.status_reference.nil? && (labels.nil? || (!labels.nil? && !labels.include?(@status.status_reference.label)))
137
- warnings = "Deal status '#{@status.status_reference.label}' missing, add to settings"
140
+ warnings.push("Deal status '#{@status.status_reference.label}' missing, add to settings")
141
+ end
142
+
143
+ if @status == nil
144
+ warnings.push("No status set on deal (#{@integration_id}) '#{@name}', will be set to default status at import")
138
145
  end
139
146
 
140
- if error.length > 0
141
- error = "#{error}\n#{serialize()}"
147
+ if errors.length > 0
148
+ errors.push(serialize())
142
149
  end
143
150
 
144
- return [error, warnings]
151
+ return [errors.join('\n'), warnings.join('\n')]
145
152
  end
146
153
 
147
154
  def with_status
@@ -71,6 +71,7 @@ module MoveToGo
71
71
  ##
72
72
  # :attr_accessor: source_data
73
73
  immutable_accessor :source_data
74
+ attr_accessor :rootmodel
74
75
 
75
76
  # Sets/gets the date when this organization's relation was
76
77
  # changed. Default is Now.
@@ -80,7 +81,11 @@ module MoveToGo
80
81
  # you add custom values by using {#set_custom_value}
81
82
  attr_reader :custom_values
82
83
 
84
+ # You can read linked objects
85
+ attr_reader :deals, :histories, :documents
86
+
83
87
  def initialize(opt = nil)
88
+ @employees = []
84
89
  if !opt.nil?
85
90
  serialize_variables.each do |myattr|
86
91
  val = opt[myattr[:id]]
@@ -180,6 +185,18 @@ module MoveToGo
180
185
  end
181
186
  end
182
187
 
188
+ def deals
189
+ @rootmodel.find_deals_for_organization(self)
190
+ end
191
+
192
+ def histories
193
+ @rootmodel.select_histories{|history| history.organization == self}
194
+ end
195
+
196
+ def documents(type)
197
+ @rootmodel.select_documents(type){|doc| doc.organization == self}
198
+ end
199
+
183
200
  # Sets the organization's relation to the specified value. The
184
201
  # relation must be a valid value from the Relation module
185
202
  # otherwise an InvalidRelationError error will be thrown.
@@ -266,5 +283,64 @@ module MoveToGo
266
283
 
267
284
  return error
268
285
  end
286
+
287
+ # Moves all data from an organization to this organization. The pillaged
288
+ # org is still kept as a empty shell of itself in the rootmodel
289
+ def move_data_from(org)
290
+ flat_instance_variables_to_copy = [:@name, :@organization_number, :@email, :@web_site, :@central_phone_number]
291
+ class_instance_variables_to_copy = [:@visiting_address, :@postal_address, :@source_data]
292
+ org.instance_variables.each{ |variable|
293
+
294
+ # Only change the value if it is empty
295
+ if flat_instance_variables_to_copy.include? variable
296
+ if !self.instance_variable_get(variable)
297
+ self.instance_variable_set(variable, org.instance_variable_get(variable))
298
+ end
299
+
300
+ # Some of the instances variabels are classes
301
+
302
+ elsif class_instance_variables_to_copy.include? variable
303
+
304
+ class_instance = org.instance_variable_get(variable)
305
+ class_instance.instance_variables.each { |sub_variable|
306
+
307
+ #If there is no class, create one
308
+ if !self.instance_variable_get(variable)
309
+ case variable
310
+ when :@visit_address, :@postal_address
311
+ klass = MoveToGo::Address.new
312
+ when :@source_data
313
+ klass = MoveToGo::SourceData.new
314
+ end
315
+ self.instance_variable_set(variable, klass)
316
+ end
317
+ if !self.instance_variable_get(variable).instance_variable_get(sub_variable)
318
+ self.instance_variable_get(variable).instance_variable_set(
319
+ sub_variable, class_instance.instance_variable_get(sub_variable)
320
+ )
321
+ end
322
+ }
323
+ elsif variable == :@custom_values
324
+ org.custom_values.each{ |custom_value|
325
+ self.set_custom_value(custom_value.field, custom_value.value)
326
+ }
327
+ end
328
+ }
329
+
330
+ self.with_postal_address do
331
+
332
+ end
333
+
334
+ org.employees.each{ |person| self.add_employee(person)}
335
+
336
+ org.deals.each{ |deal| deal.instance_variable_set("@customer", self)} # Object is "immutable" if using "="
337
+
338
+ org.histories.each{|history| history.instance_variable_set("@organization", self)}
339
+
340
+ org.documents(:file).each{|file| file.instance_variable_set("@organization", self)}
341
+
342
+ org.documents(:link).each{|history| history.instance_variable_set("@organization", self)}
343
+
344
+ end
269
345
  end
270
346
  end
@@ -0,0 +1,71 @@
1
+ module MoveToGo
2
+ class Organizations < Hash
3
+
4
+ def initialize(rootmodel)
5
+ @rootmodel = rootmodel
6
+ end
7
+
8
+ class DuplicateSet < Array
9
+ # Moves all data to the first organization and returns the remaining orgs
10
+ def merge_all!()
11
+ return self.map{ |org|
12
+ if org != self.first
13
+ self.first.move_data_from(org)
14
+ org
15
+ end
16
+ }
17
+ .flatten
18
+ .compact
19
+ end
20
+ end
21
+
22
+ class DuplicateSetArray < Array
23
+
24
+ def initialize(rootmodel, array)
25
+ @rootmodel = rootmodel
26
+ super(array)
27
+ end
28
+
29
+ def map_duplicates(&block)
30
+
31
+ # Send the sets to the function that will decide to keep or remove them
32
+ # Can return Nil, a single org, empty array or an array of orgs. Compact and flatten to fix
33
+ self
34
+ .map{ |duplicate_set| yield DuplicateSet.new duplicate_set}
35
+ .flatten
36
+ .compact
37
+ end
38
+
39
+ end
40
+
41
+ #Finds duplicates based on supplied fields. Returns an DuplicateSetArray
42
+ def find_duplicates_by(*raw_fields_to_check)
43
+ # map fields to instance variable name or to class. For example :name
44
+ # or "visiting_address.city" => [:visiting_address, :city]
45
+ fields_to_check = raw_fields_to_check.map{ |field|
46
+ fields = field.to_s.split(".")
47
+ case fields.length
48
+ when 1 then :"@#{field}"
49
+ when 2 then [:"@#{fields[0]}",:"@#{fields[1]}"]
50
+ else raise
51
+ end
52
+ }
53
+ # Find all posible duplicates and collect them to sets.
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
+ }
64
+ }
65
+ .select { |k, v| v.size > 1 }
66
+ .values
67
+
68
+ return DuplicateSetArray.new(@rootmodel, possible_duplicate_sets)
69
+ end
70
+ end
71
+ end
@@ -43,7 +43,7 @@ module MoveToGo
43
43
 
44
44
  def initialize()
45
45
  @settings = Settings.new
46
- @organizations = {}
46
+ @organizations = Organizations.new self
47
47
  @coworkers = {}
48
48
  @migrator_coworker = Coworker.new
49
49
  @migrator_coworker.integration_id = "migrator"
@@ -118,11 +118,41 @@ module MoveToGo
118
118
  end
119
119
 
120
120
  @organizations[organization.integration_id] = organization
121
+ organization.rootmodel = self
121
122
  organization.set_is_immutable
122
123
 
123
124
  return organization
124
125
  end
125
126
 
127
+ def remove_organization(organization)
128
+ if organization.nil?
129
+ return nil
130
+ end
131
+
132
+ if !organization.is_a?(Organization)
133
+ raise ArgumentError.new("Expected an organization")
134
+ end
135
+
136
+ if organization.integration_id.nil? || organization.integration_id.length == 0
137
+ raise IntegrationIdIsRequiredError, "An integration id is required to remove an organization"
138
+ end
139
+
140
+ find_deals_for_organization(organization)
141
+ .each{|deal| @deals.delete(deal.integration_id)}
142
+
143
+ select_histories{|history| history.organization == organization}
144
+ .each{|history| @histories.delete(history.integration_id)}
145
+
146
+ select_documents(:file){|file| file.organization == organization}
147
+ .each{|file| @documents.files.delete(file.integration_id)}
148
+
149
+ select_documents(:link){|history| history.organization == organization}
150
+ .each{|history| @documents.links.delete(history.integration_id)}
151
+
152
+ @organizations.delete(organization.integration_id)
153
+
154
+ end
155
+
126
156
  # Adds the specifed deal object to the model.
127
157
  # @example Add a deal from a new deal
128
158
  # deal = MoveToGo::Deal.new
@@ -421,6 +451,16 @@ module MoveToGo
421
451
  return result
422
452
  end
423
453
 
454
+ # Finds a history based on one of its property.
455
+ # Returns all found matching history
456
+ # @example Finds a history on its name
457
+ # rm.select_history {|history| history.text == "hello!" }
458
+ def select_histories(report_result=!!configuration[:report_result], &block)
459
+ result = select(@histories.values.flatten, &block)
460
+ report_failed_to_find_object("history") if result.nil? and report_result
461
+ return result
462
+ end
463
+
424
464
  # Finds a document based on one of its property.
425
465
  # Returns the first found matching document
426
466
  # @example Finds a document on its name
@@ -432,6 +472,17 @@ module MoveToGo
432
472
  return result
433
473
  end
434
474
 
475
+ # Finds a document based on one of its property.
476
+ # Returns all found matching document
477
+ # @example Finds a document on its name
478
+ # rm.find_document(:file) {|document| document.name == "Important Tender" }
479
+ def select_documents(type, report_result=!!configuration[:report_result], &block)
480
+ result = select(@documents.files, &block) if type == :file
481
+ result = select(@documents.links, &block) if type == :link
482
+ report_failed_to_find_object("document") if result.nil? and report_result
483
+ return result
484
+ end
485
+
435
486
  # Returns a string describing problems with the data. For
436
487
  # instance if integration_id for any entity is not unique.
437
488
  def sanity_check
@@ -624,6 +675,14 @@ module MoveToGo
624
675
  " Documents: #{nbr_of_documents}"
625
676
  end
626
677
 
678
+ # Maps organization duplicates from the rootmodel, only returned
679
+ def map_organization_duplicates!(fields_to_check=[:name], &block)
680
+ dc = MoveToGo::DuplicateChecker.new(fields_to_check, self)
681
+ dc.map_organization_duplicates! do |duplicate_set|
682
+ yield duplicate_set
683
+ end
684
+ end
685
+
627
686
  private
628
687
  # returns all items from the object array with duplicate integration ids.
629
688
  # To get all organizations with the same integration_id use
@@ -0,0 +1,208 @@
1
+ require 'spec_helper'
2
+ require 'move-to-go'
3
+
4
+ describe MoveToGo::Organizations do
5
+ it "should find duplicates based on name of the organizations" do
6
+ # given
7
+ model = MoveToGo::RootModel.new
8
+
9
+ organization = MoveToGo::Organization.new
10
+ organization.name = "Lundalogik AB"
11
+ organization.integration_id = "1337"
12
+ model.add_organization(organization)
13
+
14
+ (1..3).each do |n|
15
+ organization = MoveToGo::Organization.new
16
+ organization.name = "Ankeborgs bibliotek"
17
+ organization.integration_id = n.to_s
18
+ model.add_organization(organization)
19
+ end
20
+
21
+ set_to_check = []
22
+ model.organizations
23
+ .find_duplicates_by(:name)
24
+ .each do |duplicate_set|
25
+ set_to_check = duplicate_set
26
+ end
27
+ # when, the
28
+ set_to_check.length.should eq 3
29
+ end
30
+
31
+ it "should not find duplicates based on name and integration id of the organizations" do
32
+ # given
33
+ model = MoveToGo::RootModel.new
34
+
35
+ (1..3).each do |n|
36
+ organization = MoveToGo::Organization.new
37
+ organization.name = "Ankeborgs bibliotek"
38
+ organization.integration_id = n.to_s
39
+ model.add_organization(organization)
40
+ end
41
+
42
+ set_to_check = []
43
+ model.organizations
44
+ .find_duplicates_by(:name, :integration_id)
45
+ .each do |duplicate_set|
46
+ set_to_check = duplicate_set
47
+ end
48
+ # when, the
49
+ set_to_check.length.should eq 0
50
+ end
51
+
52
+ it "should work with address" do
53
+ # given
54
+ model = MoveToGo::RootModel.new
55
+
56
+ (1..3).each do |n|
57
+ organization = MoveToGo::Organization.new
58
+ organization.name = "Ankeborgs bibliotek"
59
+ organization.integration_id = n.to_s
60
+ organization.with_postal_address do |address|
61
+ address.city = "Lund"
62
+ end
63
+ model.add_organization(organization)
64
+ end
65
+
66
+ set_to_check = []
67
+ model.organizations
68
+ .find_duplicates_by("name", "postal_address.city")
69
+ .map do |duplicate_set|
70
+ set_to_check = duplicate_set
71
+ end
72
+ # when, the
73
+ set_to_check.length.should eq 3
74
+ end
75
+
76
+ it "should find duplicates based on name of the organizations" do
77
+ # given
78
+ model = MoveToGo::RootModel.new
79
+
80
+ organization = MoveToGo::Organization.new
81
+ organization.name = "Lundalogik AB"
82
+ organization.integration_id = "1337"
83
+ model.add_organization(organization)
84
+
85
+ (1..3).each do |n|
86
+ organization = MoveToGo::Organization.new
87
+ organization.name = "Ankeborgs bibliotek"
88
+ organization.integration_id = n.to_s
89
+ model.add_organization(organization)
90
+ end
91
+
92
+ set_to_check = []
93
+ model.organizations
94
+ .find_duplicates_by(:name)
95
+ .map do |duplicate_set|
96
+ set_to_check = duplicate_set
97
+ end
98
+ # when, the
99
+ set_to_check.length.should eq 3
100
+ end
101
+
102
+ it "should work with a single organization in rootmodel" do
103
+ # given
104
+ model = MoveToGo::RootModel.new
105
+
106
+ organization = MoveToGo::Organization.new
107
+ organization.name = "Lundalogik AB"
108
+ organization.integration_id = "1337"
109
+ model.add_organization(organization)
110
+
111
+ set_to_check = []
112
+ model.organizations
113
+ .find_duplicates_by(:name)
114
+ .map do |duplicate_set|
115
+ set_to_check = duplicate_set
116
+ end
117
+ # when, the
118
+ set_to_check.length.should eq 0
119
+ end
120
+
121
+ it "should be able to merge duplicates" do
122
+ # given
123
+ model = MoveToGo::RootModel.new
124
+
125
+ (1..3).each do |n|
126
+ organization = MoveToGo::Organization.new
127
+ organization.name = "Ankeborgs bibliotek"
128
+ organization.integration_id = n.to_s
129
+ model.add_organization(organization)
130
+
131
+ person = MoveToGo::Person.new
132
+ person.first_name = "Kalle"
133
+ organization.add_employee(person)
134
+
135
+ deal = MoveToGo::Deal.new
136
+ deal.name = "Big deal"
137
+ deal.integration_id = n.to_s
138
+ deal.customer = organization
139
+ model.add_deal(deal)
140
+
141
+ note = MoveToGo::History.new
142
+ note.text = "Hello"
143
+ note.organization = organization
144
+ model.add_history(note)
145
+
146
+ end
147
+
148
+ model.organizations
149
+ .find_duplicates_by(:name)
150
+ .map_duplicates{ |duplicate_set|
151
+ duplicate_set.merge_all!
152
+ }
153
+ .each{ |duplicate_org|
154
+ model.remove_organization(duplicate_org)
155
+ }
156
+
157
+ # when, the
158
+ model.organizations.values.length.should eq 1
159
+ model.organizations.values.first.employees.length.should eq 3
160
+ model.organizations.values.first.deals.length.should eq 3
161
+ model.organizations.values.first.histories.length.should eq 3
162
+ end
163
+
164
+ it "should be able to merge fields of an organizations to empty fields on another organization" do
165
+ # given
166
+ model = MoveToGo::RootModel.new
167
+
168
+ model.settings.with_organization do |setting|
169
+ setting.set_custom_field({:integration_id=>"link_to_bi_system", :title=>"Link to BI system"})
170
+ end
171
+
172
+ org1 = MoveToGo::Organization.new
173
+ org1.name = "Lundalogik AB"
174
+ org1.integration_id = "1337"
175
+ org1.email = "info@lundalogik.se"
176
+ model.add_organization(org1)
177
+
178
+ org2 = MoveToGo::Organization.new
179
+ org2.name = "Lundalogik AB"
180
+ org2.organization_number = "123"
181
+ org2.integration_id = "123"
182
+ org2.email = "inbox@lundalogik.com"
183
+ org2.with_postal_address do |address|
184
+ address.city = "Lund"
185
+ address.street = "Sankt Lars"
186
+ end
187
+ org2.set_custom_value("link_to_bi_system", "https")
188
+
189
+ model.add_organization(org2)
190
+
191
+ model.organizations
192
+ .find_duplicates_by(:name)
193
+ .map_duplicates do |duplicate_set|
194
+ master_org = duplicate_set.find {|org| org.integration_id == "1337"}
195
+ org_to_be_merged = duplicate_set.find {|org| org.integration_id == "123"}
196
+ master_org.move_data_from(org_to_be_merged)
197
+ end
198
+
199
+ org = model.find_organization_by_integration_id("1337")
200
+ # when, the
201
+ org.organization_number.should eq "123"
202
+ org.email.should eq "info@lundalogik.se"
203
+ org.postal_address.city.should eq "Lund"
204
+ org.postal_address.street.should eq "Sankt Lars"
205
+ org.custom_values.first.value.should eq "https"
206
+ end
207
+
208
+ end
@@ -994,4 +994,97 @@ describe "RootModel" do
994
994
  # then
995
995
  result.should eq []
996
996
  end
997
+
998
+ it "should delete an organization and its linked objects" do
999
+ # given
1000
+ org = MoveToGo::Organization.new
1001
+ org.name = "Lundalogik"
1002
+ org.integration_id = "1"
1003
+ person = MoveToGo::Person.new
1004
+ person.first_name = "Kalle"
1005
+ person.email = "kalle@kula.se"
1006
+ person.position = "Chief"
1007
+ org.add_employee(person)
1008
+ rootmodel.add_organization(org)
1009
+
1010
+
1011
+ deal = MoveToGo::Deal.new
1012
+ deal.name = "Bigger Deal"
1013
+ deal.value = 1234
1014
+ deal.integration_id = "2"
1015
+ deal.customer = org
1016
+ rootmodel.add_deal deal
1017
+
1018
+
1019
+ note = MoveToGo::History.new
1020
+ note.text = "Hello"
1021
+ note.organization = org
1022
+ note.deal = deal
1023
+ rootmodel.add_history(note)
1024
+
1025
+ rootmodel.remove_organization(org)
1026
+
1027
+ # when
1028
+ result = rootmodel.organizations.length + rootmodel.deals.length + rootmodel.histories.length
1029
+
1030
+ # then
1031
+ result.should eq 0
1032
+ end
1033
+
1034
+ it "should only delete what it needs to delete when deleting an organization and its linked objects" do
1035
+ # given
1036
+ org = MoveToGo::Organization.new
1037
+ org.name = "Lundalogik"
1038
+ org.integration_id = "1"
1039
+ person = MoveToGo::Person.new
1040
+ person.first_name = "Kalle"
1041
+ person.email = "kalle@kula.se"
1042
+ person.position = "Chief"
1043
+ org.add_employee(person)
1044
+ rootmodel.add_organization(org)
1045
+
1046
+ deal = MoveToGo::Deal.new
1047
+ deal.name = "Bigger Deal"
1048
+ deal.value = 1234
1049
+ deal.integration_id = "1"
1050
+ deal.customer = org
1051
+ rootmodel.add_deal deal
1052
+
1053
+ note = MoveToGo::History.new
1054
+ note.text = "Hello"
1055
+ note.organization = org
1056
+ note.deal = deal
1057
+ rootmodel.add_history(note)
1058
+
1059
+ org = MoveToGo::Organization.new
1060
+ org.name = "Lundalogik Stockholm"
1061
+ org.integration_id = "2"
1062
+ person = MoveToGo::Person.new
1063
+ person.first_name = "Kalle"
1064
+ person.email = "kalle@kula.se"
1065
+ person.position = "Chief"
1066
+ org.add_employee(person)
1067
+ rootmodel.add_organization(org)
1068
+
1069
+ deal = MoveToGo::Deal.new
1070
+ deal.name = "Bigger Deal"
1071
+ deal.value = 1234
1072
+ deal.integration_id = "2"
1073
+ deal.customer = org
1074
+ rootmodel.add_deal deal
1075
+
1076
+ note = MoveToGo::History.new
1077
+ note.text = "Hello"
1078
+ note.organization = org
1079
+ note.deal = deal
1080
+ rootmodel.add_history(note)
1081
+
1082
+ rootmodel.remove_organization(org)
1083
+
1084
+ # when
1085
+ result = rootmodel.organizations.length + rootmodel.deals.length + rootmodel.histories.length
1086
+
1087
+ # then
1088
+ result.should eq 3
1089
+ end
997
1090
  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.4
4
+ version: 5.0.6
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: 2016-11-24 00:00:00.000000000 Z
16
+ date: 2017-01-03 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: iso_country_codes
@@ -205,6 +205,7 @@ files:
205
205
  - lib/move-to-go/model/history_classification.rb
206
206
  - lib/move-to-go/model/link.rb
207
207
  - lib/move-to-go/model/organization.rb
208
+ - lib/move-to-go/model/organizations.rb
208
209
  - lib/move-to-go/model/person.rb
209
210
  - lib/move-to-go/model/referencetosource.rb
210
211
  - lib/move-to-go/model/relation.rb
@@ -311,6 +312,7 @@ files:
311
312
  - spec/history_spec.rb
312
313
  - spec/link_spec.rb
313
314
  - spec/organization_spec.rb
315
+ - spec/organizations_spec.rb
314
316
  - spec/person_spec.rb
315
317
  - spec/rootmodel_spec.rb
316
318
  - spec/spec_helper.rb
@@ -356,6 +358,7 @@ test_files:
356
358
  - spec/helpers/xsd_validate_spec.rb
357
359
  - spec/history_spec.rb
358
360
  - spec/link_spec.rb
361
+ - spec/organizations_spec.rb
359
362
  - spec/organization_spec.rb
360
363
  - spec/person_spec.rb
361
364
  - spec/rootmodel_spec.rb