move-to-go 5.0.0 → 5.0.1

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: 30c626193cc7bca95c36653b34caaf2bf9e7b593
4
- data.tar.gz: 0ffa9010615f179ed02e9c0a51b7f9723eee3cfd
3
+ metadata.gz: 3432a21214fd654ee6525aae7c3bed240d0edaff
4
+ data.tar.gz: 082ef1bb58a2655efc1b615bd327bce34e2647fe
5
5
  SHA512:
6
- metadata.gz: 6338cf52b8472ffd1d4ccc2a494d2191549b27aa290e8feed5971e9716f7d9eac84662dc87a472c40b7830cbda310b1390209763fdaa03817116c22e11c42119
7
- data.tar.gz: d961df52d8fa809abd86d355420da3eaf626b60a04a8bcac207829d911943cae79fe9b5c8eaa2ad01bba18232a60308bb00e03bc46c95a9182e7f2c3bc25ee43
6
+ metadata.gz: f96e72d111006eba2ec0916242eac531b0004dc8dcf12cb4a089f67266ffc9a1651ebdd1be3b0f041fda8907b51e2f23aff1b95b679e725aa90b309bea25cd6f
7
+ data.tar.gz: 7695fad6ccdb1da5be3bea3ee7903423f0eeebc8be4e391bafa2a5bfb0e346f7a736a2c3625817d5f564ce3f4f952cb12a44e962bd63a8d66405842a425c2f9e
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  module MoveToGo
3
2
  class Coworker < CanBecomeImmutable
4
3
  include SerializeHelper
@@ -78,5 +77,20 @@ module MoveToGo
78
77
  return "#{firstname}.#{lastname}@#{domain}"
79
78
  end
80
79
 
80
+ def validate
81
+ error = String.new
82
+
83
+ if (@first_name.nil? || @first_name.empty?) &&
84
+ (@last_name.nil? || @last_name.empty?)
85
+ error = "A firstname or lastname is required for coworker.\n#{serialize()}"
86
+ end
87
+
88
+ if @email.nil? || @email.empty?
89
+ error = "#{error}\nAn email is required for coworker.\n"
90
+ end
91
+
92
+ return error
93
+ end
94
+
81
95
  end
82
96
  end
@@ -5,7 +5,7 @@ require 'securerandom'
5
5
  require "progress"
6
6
 
7
7
  module MoveToGo
8
- # The root model for Go import. This class is the container for everything else.
8
+ # The root model for Move To Go. This class is the container for everything else.
9
9
  class RootModel
10
10
  # the migrator_coworker is a special coworker that is set as
11
11
  # responsible for objects that requires a coworker, eg a history.
@@ -48,6 +48,7 @@ module MoveToGo
48
48
  @migrator_coworker = Coworker.new
49
49
  @migrator_coworker.integration_id = "migrator"
50
50
  @migrator_coworker.first_name = "Migrator"
51
+ @migrator_coworker.email = "noreply-migrator@lime-go.com"
51
52
  @coworkers[@migrator_coworker.integration_id] = @migrator_coworker
52
53
  @deals = {}
53
54
  @histories = {}
@@ -474,6 +475,14 @@ module MoveToGo
474
475
  errors = String.new
475
476
  warnings = String.new
476
477
 
478
+ @coworkers.each do |key, coworker|
479
+ validation_mesage = coworker.validate
480
+
481
+ if !validation_mesage.empty?
482
+ errors = "#{errors}\n#{validation_mesage}"
483
+ end
484
+ end
485
+
477
486
  @organizations.each do |k, o|
478
487
  validation_message = o.validate()
479
488
 
@@ -481,7 +490,7 @@ module MoveToGo
481
490
  errors = "#{errors}\n#{validation_message}"
482
491
  end
483
492
  end
484
-
493
+
485
494
  converter_deal_statuses = @settings.deal.statuses.map {|status| status.label} if @settings.deal != nil
486
495
  @deals.each do |key, deal|
487
496
  error, warning = deal.validate converter_deal_statuses
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  require "spec_helper"
3
2
  require 'move-to-go'
4
3
 
@@ -7,6 +6,42 @@ describe "Coworker" do
7
6
  MoveToGo::Coworker.new
8
7
  }
9
8
 
9
+ describe "coworker" do
10
+ it "must have a first name and email" do
11
+ # given
12
+ coworker.first_name = "billy"
13
+ coworker.email = "billy@movetogo.com"
14
+
15
+ # when, then
16
+ coworker.validate.should eq ""
17
+ end
18
+
19
+ it "must have a last name and email" do
20
+ # given
21
+ coworker.first_name = "bob"
22
+ coworker.email = "billy@movetogo.com"
23
+
24
+ # when, then
25
+ coworker.validate.should eq ""
26
+ end
27
+
28
+ it "must have either first or last name and email" do
29
+ # given
30
+ coworker.email = "billy@movetogo.com"
31
+
32
+ # when, then
33
+ coworker.validate.length.should > 1
34
+ end
35
+
36
+ it "must have email" do
37
+ # given
38
+ coworker.first_name = "billy"
39
+
40
+ # when, then
41
+ coworker.validate.length.should > 1
42
+ end
43
+ end
44
+
10
45
  describe "parse_name_to_firstname_lastname_se" do
11
46
  it "can parse 'Kalle Nilsson' into firstname 'Kalle' and lastname 'Nilsson'" do
12
47
  coworker.parse_name_to_firstname_lastname_se 'Kalle Nilsson'
@@ -11,6 +11,10 @@ describe "RootModel" do
11
11
  rootmodel.coworkers.length.should eq 1
12
12
  end
13
13
 
14
+ it "will contain a migration coworker with email" do
15
+ rootmodel.find_coworker_by_integration_id("migrator").email.length.should > 1
16
+ end
17
+
14
18
  it "can add a coworker from a new coworker" do
15
19
  # given
16
20
  coworker = MoveToGo::Coworker.new
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.0
4
+ version: 5.0.1
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-08-22 00:00:00.000000000 Z
16
+ date: 2016-08-24 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: iso_country_codes
@@ -169,9 +169,9 @@ dependencies:
169
169
  - - ">="
170
170
  - !ruby/object:Gem::Version
171
171
  version: '0'
172
- description: " move-to-go is an import tool for LIME Go. It can take virtually any
173
- input source and create zip-files that LIME Go likes. \n move-to-go has some predefined
174
- sources that makes will help you migrate your data.\n"
172
+ description: " move-to-go is an migration tool for Lime Go. It can take virtually
173
+ any input source and create zip-files that LIME Go likes. \n move-to-go has some
174
+ predefined sources that makes will help you migrate your data.\n"
175
175
  email: support@lundalogik.se
176
176
  executables:
177
177
  - move-to-go
@@ -333,7 +333,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
333
333
  version: '0'
334
334
  requirements: []
335
335
  rubyforge_project:
336
- rubygems_version: 2.2.3
336
+ rubygems_version: 2.4.6
337
337
  signing_key:
338
338
  specification_version: 4
339
339
  summary: Tool to generate Lime Go zip import files