go_import 3.0.42 → 4.0.0

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.
@@ -3,9 +3,9 @@ require 'go_import'
3
3
 
4
4
  describe GoImport::SerializeHelper do
5
5
 
6
- describe "Serialize note" do
6
+ describe "Serialize history" do
7
7
  let(:serialized) {
8
- n = GoImport::Note.new
8
+ n = GoImport::History.new
9
9
  n.text = "text"
10
10
  GoImport::SerializeHelper::serialize(n,-1)
11
11
  }
@@ -13,16 +13,16 @@ describe GoImport::SerializeHelper do
13
13
  serialized.should match(/<Text>[\n ]*text[\n ]*<\/Text>/)
14
14
  end
15
15
  it "should contain start tag" do
16
- serialized.should match(/<Note>/)
16
+ serialized.should match(/<History>/)
17
17
  end
18
18
  it "should be utf-8" do
19
19
  serialized.encoding.should equal Encoding::UTF_8
20
20
  end
21
21
  end
22
22
 
23
- describe "Serialize note with xml inside" do
23
+ describe "Serialize history with xml inside" do
24
24
  let(:serialized) {
25
- n = GoImport::Note.new
25
+ n = GoImport::History.new
26
26
  n.text = "<text>"
27
27
  GoImport::SerializeHelper::serialize(n,-1)
28
28
  }
@@ -192,7 +192,7 @@ describe GoImport::SerializeHelper do
192
192
  serialized.should match(/Ankeborgs bibliotek/)
193
193
  end
194
194
  it "should have version" do
195
- serialized.should match(/<GoImport Version='v2_0'/)
195
+ serialized.should match(/<GoImport Version='v3_0'/)
196
196
  end
197
197
  it "should be utf-8" do
198
198
  serialized.encoding.should equal Encoding::UTF_8
@@ -49,9 +49,9 @@ describe GoImport::ShardHelper do
49
49
  end
50
50
 
51
51
  (1..10).each do |n|
52
- note = GoImport::Note.new
53
- note.text = "Important note"
54
- model.add_note(note)
52
+ history = GoImport::History.new
53
+ history.text = "Important history"
54
+ model.add_history(history)
55
55
  end
56
56
 
57
57
  (1..10).each do |n|
@@ -0,0 +1,150 @@
1
+ require "spec_helper"
2
+ require 'go_import'
3
+
4
+ describe "History" do
5
+ let("history") {
6
+ GoImport::History.new
7
+ }
8
+
9
+ it "must have a text" do
10
+ history.validate.length.should be > 0
11
+ end
12
+
13
+ it "is valid when it has text, created_by and organization" do
14
+ # given
15
+ history.text = "They are very interested in the new deal (the one where you get a free bike as a gift)"
16
+ history.created_by = GoImport::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
17
+ history.organization = GoImport::Organization.new({ :integration_id => "456", :heading => "Lundalogik" })
18
+
19
+ # when, then
20
+ history.validate.should eq ""
21
+ end
22
+
23
+ it "is valid when it has text, created_by and person" do
24
+ # given
25
+ history.text = "They are very interested in the new deal (the one where you get a free bike as a gift)"
26
+ history.created_by = GoImport::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
27
+ history.person = GoImport::Person.new({ :integration_id => "456", :heading => "Billy Bob" })
28
+
29
+ # when, then
30
+ history.validate.should eq ""
31
+ end
32
+
33
+ it "is valid when it has text, created_by and deal" do
34
+ # given
35
+ history.text = "They are very interested in the new deal (the one where you get a free bike as a gift)"
36
+ history.created_by = GoImport::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
37
+ history.deal = GoImport::Deal.new({ :integration_id => "456", :heading => "The new deal" })
38
+
39
+ # when, then
40
+ history.validate.should eq ""
41
+ end
42
+
43
+ it "is invalid if no history has no attached objects" do
44
+ # given
45
+ history.text = "They are very interested in the new deal (the one where you get a free bike as a gift)"
46
+ history.created_by = GoImport::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
47
+
48
+ # when, then
49
+ history.validate.length.should be > 0
50
+ end
51
+
52
+ it "will set organization ref when organization is assigned" do
53
+ # given
54
+ org = GoImport::Organization.new({:integration_id => "123", :name => "Beagle Boys!"})
55
+
56
+ # when
57
+ history.organization = org
58
+
59
+ # then
60
+ history.organization.is_a?(GoImport::Organization).should eq true
61
+ history.instance_variable_get(:@organization_reference).is_a?(GoImport::OrganizationReference).should eq true
62
+ end
63
+
64
+ it "will set person ref when person is assigned" do
65
+ # given
66
+ person = GoImport::Person.new({:integration_id => "123" })
67
+ person.parse_name_to_firstname_lastname_se "Billy Bob"
68
+
69
+ # when
70
+ history.person = person
71
+
72
+ # then
73
+ history.person.is_a?(GoImport::Person).should eq true
74
+ history.instance_variable_get(:@person_reference).is_a?(GoImport::PersonReference).should eq true
75
+ end
76
+
77
+ it "will set coworker ref when coworker is assigned" do
78
+ # given
79
+ coworker = GoImport::Coworker.new({:integration_id => "123" })
80
+ coworker.parse_name_to_firstname_lastname_se "Billy Bob"
81
+
82
+ # when
83
+ history.created_by = coworker
84
+
85
+ # then
86
+ history.created_by.is_a?(GoImport::Coworker).should eq true
87
+ history.instance_variable_get(:@created_by_reference).is_a?(GoImport::CoworkerReference).should eq true
88
+ end
89
+
90
+ it "will set deal ref when deal is assigned" do
91
+ # given
92
+ deal = GoImport::Deal.new({:integration_id => "123" })
93
+ deal.name = "The new deal"
94
+
95
+ # when
96
+ history.deal = deal
97
+
98
+ # then
99
+ history.deal.is_a?(GoImport::Deal).should eq true
100
+ history.instance_variable_get(:@deal_reference).is_a?(GoImport::DealReference).should eq true
101
+ end
102
+
103
+ it "should have Comment as default classification" do
104
+ # then
105
+ history.classification.should eq GoImport::HistoryClassification::Comment
106
+ end
107
+
108
+ it "should not accept invalid classifications" do
109
+ # when, then
110
+ expect {
111
+ history.classification = "hubbabubba"
112
+ }.to raise_error(GoImport::InvalidHistoryClassificationError)
113
+ end
114
+
115
+ it "should remove form feed from text" do
116
+ # given
117
+ textWithFormFeed = "Text with form feed"
118
+ textWithoutFormFeed = "Text with form feed"
119
+
120
+ # when
121
+ history.text = textWithFormFeed
122
+
123
+ # then
124
+ history.text.should eq textWithoutFormFeed
125
+ end
126
+
127
+ it "should remove vertical tab from text" do
128
+ # given
129
+ textWithVerticalTab = "Text with \vvertical tab"
130
+ textWithoutVerticalTab = "Text with vertical tab"
131
+
132
+ # when
133
+ history.text = textWithVerticalTab
134
+
135
+ # then
136
+ history.text.should eq textWithoutVerticalTab
137
+ end
138
+
139
+ it "should remove backspace from text" do
140
+ # given
141
+ textWithBackSpace = "Text with \bbackspace"
142
+ textWithoutBackSpace = "Text with backspace"
143
+
144
+ # when
145
+ history.text = textWithBackSpace
146
+
147
+ # then
148
+ history.text.should eq textWithoutBackSpace
149
+ end
150
+ end
@@ -107,7 +107,7 @@ describe "RootModel" do
107
107
 
108
108
  it "will only add organizations" do
109
109
  # given
110
- not_an_organization = { :integration_id => "123", :name => "This is not a note"}
110
+ not_an_organization = { :integration_id => "123", :name => "This is not a history"}
111
111
 
112
112
  # when, then
113
113
  expect {
@@ -305,77 +305,77 @@ describe "RootModel" do
305
305
  }.to raise_error(GoImport::IntegrationIdIsRequiredError)
306
306
  end
307
307
 
308
- it "will only add notes" do
308
+ it "will only add history" do
309
309
  # given
310
- not_a_note = { :integration_id => "123", :text => "This is not a note"}
310
+ not_a_history = { :integration_id => "123", :text => "This is not a history"}
311
311
 
312
312
  # when, then
313
313
  expect {
314
- rootmodel.add_note(not_a_note)
314
+ rootmodel.add_history(not_a_history)
315
315
  }.to raise_error(ArgumentError)
316
- rootmodel.notes.length.should eq 0
316
+ rootmodel.histories.length.should eq 0
317
317
  end
318
318
 
319
- it "will make note immutable after it has been added" do
319
+ it "will make history immutable after it has been added" do
320
320
  # given
321
- note = GoImport::Note.new
322
- note.text = "this is a note"
321
+ history = GoImport::History.new
322
+ history.text = "this is a history"
323
323
 
324
324
  # when
325
- rootmodel.add_note(note)
325
+ rootmodel.add_history(history)
326
326
 
327
327
  # then
328
- note.is_immutable.should eq true
328
+ history.is_immutable.should eq true
329
329
  end
330
330
 
331
- it "can add a note from a new note" do
331
+ it "can add a history from a new history" do
332
332
  # given
333
- note = GoImport::Note.new
334
- note.integration_id = "123key"
335
- note.text = "This is a note"
333
+ history = GoImport::History.new
334
+ history.integration_id = "123key"
335
+ history.text = "This is a history"
336
336
 
337
337
  # when
338
- rootmodel.add_note(note)
338
+ rootmodel.add_history(history)
339
339
 
340
340
  # then
341
- rootmodel.find_note_by_integration_id("123key").text.should eq "This is a note"
342
- rootmodel.notes.length.should eq 1
341
+ rootmodel.find_history_by_integration_id("123key").text.should eq "This is a history"
342
+ rootmodel.histories.length.should eq 1
343
343
  end
344
344
 
345
- it "will generate an integration id if the new note dont have one" do
345
+ it "will generate an integration id if the new history dont have one" do
346
346
  # given
347
- note = GoImport::Note.new
348
- note.text = "This is a note"
347
+ history = GoImport::History.new
348
+ history.text = "This is a history"
349
349
 
350
350
  # when
351
- rootmodel.add_note(note)
351
+ rootmodel.add_history(history)
352
352
 
353
353
  # then
354
- note.integration_id.length.should be > 0
354
+ history.integration_id.length.should be > 0
355
355
  end
356
356
 
357
- it "will generate unique integration ids for each note" do
357
+ it "will generate unique integration ids for each history" do
358
358
  # given
359
- note1 = GoImport::Note.new
360
- note1.text = "This is a note"
359
+ history1 = GoImport::History.new
360
+ history1.text = "This is a history"
361
361
 
362
- note2 = GoImport::Note.new
363
- note2.text = "This is a different note"
362
+ history2 = GoImport::History.new
363
+ history2.text = "This is a different history"
364
364
 
365
365
  # when
366
- rootmodel.add_note note1
367
- rootmodel.add_note note2
366
+ rootmodel.add_history history1
367
+ rootmodel.add_history history2
368
368
 
369
369
  # then
370
- note1.integration_id.should be != note2.integration_id
370
+ history1.integration_id.should be != history2.integration_id
371
371
  end
372
372
 
373
- it "will not add a nil note" do
373
+ it "will not add a nil history" do
374
374
  # given, when
375
- rootmodel.add_note(nil)
375
+ rootmodel.add_history(nil)
376
376
 
377
377
  # then
378
- rootmodel.notes.length.should eq 0
378
+ rootmodel.histories.length.should eq 0
379
379
  end
380
380
 
381
381
  it "will not add a nil organization" do
@@ -431,25 +431,25 @@ describe "RootModel" do
431
431
  rootmodel.documents.files.length.should eq 1
432
432
  end
433
433
 
434
- it "will not add a new note when the note is already added (same integration id)" do
434
+ it "will not add a new history when the history is already added (same integration id)" do
435
435
  # given
436
- note = GoImport::Note.new({
436
+ history = GoImport::History.new({
437
437
  :integration_id => "123key",
438
- :text => "This is a note"
438
+ :text => "This is a history"
439
439
  })
440
- rootmodel.add_note(note)
441
- rootmodel.notes.length.should eq 1
440
+ rootmodel.add_history(history)
441
+ rootmodel.histories.length.should eq 1
442
442
 
443
443
  # when, then
444
- note2 = GoImport::Note.new({
444
+ history2 = GoImport::History.new({
445
445
  :integration_id => "123key",
446
- :text => "This is another note"
446
+ :text => "This is another history"
447
447
  })
448
448
  expect {
449
- rootmodel.add_note(note2)
449
+ rootmodel.add_history(history2)
450
450
  }.to raise_error(GoImport::AlreadyAddedError)
451
- rootmodel.notes.length.should eq 1
452
- rootmodel.find_note_by_integration_id("123key").text.should eq "This is a note"
451
+ rootmodel.histories.length.should eq 1
452
+ rootmodel.find_history_by_integration_id("123key").text.should eq "This is a history"
453
453
  end
454
454
 
455
455
  it "Will find a person by integration id" do
@@ -674,39 +674,39 @@ describe "RootModel" do
674
674
  result.should eq nil
675
675
  end
676
676
 
677
- it "will find an note based on a property" do
677
+ it "will find an history based on a property" do
678
678
  # given
679
679
  organization = GoImport::Organization.new
680
680
  organization.name = "Hubba Bubba"
681
681
  organization.integration_id = "321"
682
682
  rootmodel.add_organization(organization)
683
683
 
684
- note = GoImport::Note.new
685
- note.text = "Hello!"
686
- note.organization = organization
684
+ history = GoImport::History.new
685
+ history.text = "Hello!"
686
+ history.organization = organization
687
687
 
688
- rootmodel.add_note(note)
688
+ rootmodel.add_history(history)
689
689
  # when
690
- result = rootmodel.find_note{|n| n.text == "Hello!"}
690
+ result = rootmodel.find_history{|n| n.text == "Hello!"}
691
691
 
692
692
  # then
693
- result.should eq note
693
+ result.should eq history
694
694
  end
695
695
 
696
- it "will return nil if it doesn't find a note on a property" do
696
+ it "will return nil if it doesn't find a history on a property" do
697
697
  # given
698
698
  organization = GoImport::Organization.new
699
699
  organization.name = "Hubba Bubba"
700
700
  organization.integration_id = "321"
701
701
  rootmodel.add_organization(organization)
702
702
 
703
- note = GoImport::Note.new
704
- note.text = "Hello!"
705
- note.organization = organization
703
+ history = GoImport::History.new
704
+ history.text = "Hello!"
705
+ history.organization = organization
706
706
 
707
- rootmodel.add_note(note)
707
+ rootmodel.add_history(history)
708
708
  # when
709
- result = rootmodel.find_note{|n| n.text == "Goodbye!"}
709
+ result = rootmodel.find_history{|n| n.text == "Goodbye!"}
710
710
 
711
711
  # then
712
712
  result.should eq nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go_import
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.42
4
+ version: 4.0.0
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-05-03 00:00:00.000000000 Z
16
+ date: 2016-05-26 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: iso_country_codes
@@ -198,9 +198,9 @@ files:
198
198
  - lib/go_import/model/deal_status_setting.rb
199
199
  - lib/go_import/model/documents.rb
200
200
  - lib/go_import/model/file.rb
201
+ - lib/go_import/model/history.rb
202
+ - lib/go_import/model/history_classification.rb
201
203
  - lib/go_import/model/link.rb
202
- - lib/go_import/model/note.rb
203
- - lib/go_import/model/note_classification.rb
204
204
  - lib/go_import/model/organization.rb
205
205
  - lib/go_import/model/person.rb
206
206
  - lib/go_import/model/referencetosource.rb
@@ -229,8 +229,8 @@ files:
229
229
  - sources/base-crm/data/contacts.csv
230
230
  - sources/base-crm/data/coworkers.csv
231
231
  - sources/base-crm/data/deals.csv
232
+ - sources/base-crm/data/histories.csv
232
233
  - sources/base-crm/data/leads.csv
233
- - sources/base-crm/data/notes.csv
234
234
  - sources/base-crm/data/tasks.csv
235
235
  - sources/csv/.gitignore
236
236
  - sources/csv/.go_import/readme.txt
@@ -302,8 +302,8 @@ files:
302
302
  - spec/helpers/serialize_helper_spec.rb
303
303
  - spec/helpers/shard_helper_spec.rb
304
304
  - spec/helpers/xsd_validate_spec.rb
305
+ - spec/history_spec.rb
305
306
  - spec/link_spec.rb
306
- - spec/note_spec.rb
307
307
  - spec/organization_spec.rb
308
308
  - spec/person_spec.rb
309
309
  - spec/rootmodel_spec.rb
@@ -348,8 +348,8 @@ test_files:
348
348
  - spec/helpers/serialize_helper_spec.rb
349
349
  - spec/helpers/shard_helper_spec.rb
350
350
  - spec/helpers/xsd_validate_spec.rb
351
+ - spec/history_spec.rb
351
352
  - spec/link_spec.rb
352
- - spec/note_spec.rb
353
353
  - spec/organization_spec.rb
354
354
  - spec/person_spec.rb
355
355
  - spec/rootmodel_spec.rb
data/spec/note_spec.rb DELETED
@@ -1,150 +0,0 @@
1
- require "spec_helper"
2
- require 'go_import'
3
-
4
- describe "Note" do
5
- let("note") {
6
- GoImport::Note.new
7
- }
8
-
9
- it "must have a text" do
10
- note.validate.length.should be > 0
11
- end
12
-
13
- it "is valid when it has text, created_by and organization" do
14
- # given
15
- note.text = "They are very interested in the new deal (the one where you get a free bike as a gift)"
16
- note.created_by = GoImport::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
17
- note.organization = GoImport::Organization.new({ :integration_id => "456", :heading => "Lundalogik" })
18
-
19
- # when, then
20
- note.validate.should eq ""
21
- end
22
-
23
- it "is valid when it has text, created_by and person" do
24
- # given
25
- note.text = "They are very interested in the new deal (the one where you get a free bike as a gift)"
26
- note.created_by = GoImport::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
27
- note.person = GoImport::Person.new({ :integration_id => "456", :heading => "Billy Bob" })
28
-
29
- # when, then
30
- note.validate.should eq ""
31
- end
32
-
33
- it "is valid when it has text, created_by and deal" do
34
- # given
35
- note.text = "They are very interested in the new deal (the one where you get a free bike as a gift)"
36
- note.created_by = GoImport::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
37
- note.deal = GoImport::Deal.new({ :integration_id => "456", :heading => "The new deal" })
38
-
39
- # when, then
40
- note.validate.should eq ""
41
- end
42
-
43
- it "is invalid if no note has no attached objects" do
44
- # given
45
- note.text = "They are very interested in the new deal (the one where you get a free bike as a gift)"
46
- note.created_by = GoImport::Coworker.new( { :integration_id => "123", :heading => "kalle anka" } )
47
-
48
- # when, then
49
- note.validate.length.should be > 0
50
- end
51
-
52
- it "will set organization ref when organization is assigned" do
53
- # given
54
- org = GoImport::Organization.new({:integration_id => "123", :name => "Beagle Boys!"})
55
-
56
- # when
57
- note.organization = org
58
-
59
- # then
60
- note.organization.is_a?(GoImport::Organization).should eq true
61
- note.instance_variable_get(:@organization_reference).is_a?(GoImport::OrganizationReference).should eq true
62
- end
63
-
64
- it "will set person ref when person is assigned" do
65
- # given
66
- person = GoImport::Person.new({:integration_id => "123" })
67
- person.parse_name_to_firstname_lastname_se "Billy Bob"
68
-
69
- # when
70
- note.person = person
71
-
72
- # then
73
- note.person.is_a?(GoImport::Person).should eq true
74
- note.instance_variable_get(:@person_reference).is_a?(GoImport::PersonReference).should eq true
75
- end
76
-
77
- it "will set coworker ref when coworker is assigned" do
78
- # given
79
- coworker = GoImport::Coworker.new({:integration_id => "123" })
80
- coworker.parse_name_to_firstname_lastname_se "Billy Bob"
81
-
82
- # when
83
- note.created_by = coworker
84
-
85
- # then
86
- note.created_by.is_a?(GoImport::Coworker).should eq true
87
- note.instance_variable_get(:@created_by_reference).is_a?(GoImport::CoworkerReference).should eq true
88
- end
89
-
90
- it "will set deal ref when deal is assigned" do
91
- # given
92
- deal = GoImport::Deal.new({:integration_id => "123" })
93
- deal.name = "The new deal"
94
-
95
- # when
96
- note.deal = deal
97
-
98
- # then
99
- note.deal.is_a?(GoImport::Deal).should eq true
100
- note.instance_variable_get(:@deal_reference).is_a?(GoImport::DealReference).should eq true
101
- end
102
-
103
- it "should have Comment as default classification" do
104
- # then
105
- note.classification.should eq GoImport::NoteClassification::Comment
106
- end
107
-
108
- it "should not accept invalid classifications" do
109
- # when, then
110
- expect {
111
- note.classification = "hubbabubba"
112
- }.to raise_error(GoImport::InvalidNoteClassificationError)
113
- end
114
-
115
- it "should remove form feed from text" do
116
- # given
117
- textWithFormFeed = "Text with form feed"
118
- textWithoutFormFeed = "Text with form feed"
119
-
120
- # when
121
- note.text = textWithFormFeed
122
-
123
- # then
124
- note.text.should eq textWithoutFormFeed
125
- end
126
-
127
- it "should remove vertical tab from text" do
128
- # given
129
- textWithVerticalTab = "Text with \vvertical tab"
130
- textWithoutVerticalTab = "Text with vertical tab"
131
-
132
- # when
133
- note.text = textWithVerticalTab
134
-
135
- # then
136
- note.text.should eq textWithoutVerticalTab
137
- end
138
-
139
- it "should remove backspace from text" do
140
- # given
141
- textWithBackSpace = "Text with \bbackspace"
142
- textWithoutBackSpace = "Text with backspace"
143
-
144
- # when
145
- note.text = textWithBackSpace
146
-
147
- # then
148
- note.text.should eq textWithoutBackSpace
149
- end
150
- end