insightly 0.2.0 → 0.2.1
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.
- data/README.md +9 -1
- data/lib/insightly/contact.rb +2 -0
- data/lib/insightly/country.rb +22 -0
- data/lib/insightly/currency.rb +23 -0
- data/lib/insightly/custom_field.rb +21 -0
- data/lib/insightly/opportunity.rb +1 -1
- data/lib/insightly/opportunity_category.rb +15 -0
- data/lib/insightly/organisation.rb +2 -0
- data/lib/insightly/relationship.rb +16 -0
- data/lib/insightly/tag.rb +44 -0
- data/lib/insightly/tag_helper.rb +15 -0
- data/lib/insightly/task_category.rb +15 -0
- data/lib/insightly/team_member.rb +13 -0
- data/lib/insightly/user.rb +46 -0
- data/lib/insightly/version.rb +1 -1
- data/lib/insightly.rb +10 -0
- data/spec/unit/contact_spec.rb +226 -162
- data/spec/unit/country_spec.rb +49 -0
- data/spec/unit/currency_spec.rb +53 -0
- data/spec/unit/custom_field_spec.rb +46 -0
- data/spec/unit/opportunity_category_spec.rb +50 -0
- data/spec/unit/opportunity_spec.rb +152 -90
- data/spec/unit/organisation_spec.rb +234 -171
- data/spec/unit/relationship_spec.rb +42 -0
- data/spec/unit/tag_spec.rb +70 -0
- data/spec/unit/task_category_spec.rb +52 -0
- data/spec/unit/team_member_spec.rb +36 -0
- data/spec/unit/user_spec.rb +165 -0
- metadata +62 -43
@@ -44,36 +44,36 @@ describe Insightly::Opportunity do
|
|
44
44
|
end
|
45
45
|
it "should be able to create a opportunity" do
|
46
46
|
Insightly::Configuration.custom_fields_for_opportunities(:dummy1,
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
47
|
+
:admin_url,
|
48
|
+
:phone_number,
|
49
|
+
:timezone,
|
50
|
+
:plan,
|
51
|
+
:organization,
|
52
|
+
:company_name,
|
53
|
+
:contact_name)
|
54
|
+
|
55
|
+
o = Insightly::Opportunity.new
|
56
|
+
o.opportunity_state = "Open"
|
57
|
+
o.visible_to = "EVERYONE"
|
58
|
+
o.stage_id = "71162"
|
59
|
+
o.forecast_close_date = "2012-10-05 00:00:00"
|
60
|
+
o.responsible_user_id = "226277"
|
61
|
+
o.bid_currency = "USD"
|
62
|
+
o.opportunity_details = "This is the description"
|
63
|
+
o.category_id = "628187" #First plan list
|
64
|
+
o.bid_amount = "75"
|
65
|
+
o.pipeline_id = "24377"
|
66
|
+
o.opportunity_name = "Sample Opportunity 3"
|
67
|
+
o.contact_name = "Dirk ELmendorf"
|
68
|
+
o.company_name = "r26D"
|
69
|
+
o.organization = "TruckingOffice"
|
70
|
+
o.plan = "Owner/Operator"
|
71
|
+
o.timezone = "Central"
|
72
|
+
o.phone_number = "210-555-1212"
|
73
|
+
o.admin_url = "https://admin/companies/122"
|
74
|
+
o.bid_type = "Fixed Bid"
|
75
|
+
o.owner_user_id = "226277"
|
76
|
+
o.save
|
77
77
|
end
|
78
78
|
it "should have a url base" do
|
79
79
|
@opportunity.url_base.should == "Opportunities"
|
@@ -96,7 +96,7 @@ describe Insightly::Opportunity do
|
|
96
96
|
@opportunity.send(f.downcase.to_sym).should == @opportunity.remote_data[f]
|
97
97
|
@opportunity.send("#{f.downcase}=".to_sym, "Bob")
|
98
98
|
@opportunity.send(f.downcase.to_sym).should == "Bob"
|
99
|
-
|
99
|
+
@opportunity.remote_data[f].should == "Bob"
|
100
100
|
end
|
101
101
|
end
|
102
102
|
it "should allow you to define custom field labels" do
|
@@ -141,7 +141,7 @@ describe Insightly::Opportunity do
|
|
141
141
|
|
142
142
|
end
|
143
143
|
it "should find all the names that match" do
|
144
|
-
|
144
|
+
Insightly::Opportunity.search_by_name("Apple").should == [@opp1, @opp2]
|
145
145
|
end
|
146
146
|
it "should return an empty array if there are not matches" do
|
147
147
|
Insightly::Opportunity.search_by_name("Cobra").should == []
|
@@ -207,62 +207,124 @@ describe Insightly::Opportunity do
|
|
207
207
|
it "should set the reason to Created by API if you create an opportunity"
|
208
208
|
|
209
209
|
end
|
210
|
-
context "
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
210
|
+
context "connections" do
|
211
|
+
before(:each) do
|
212
|
+
@opportunity = Insightly::Opportunity.new(968613)
|
213
|
+
@opportunity.links = []
|
214
|
+
@opportunity.tags = []
|
215
|
+
@opportunity.save
|
216
|
+
end
|
217
|
+
|
218
|
+
context "Links" do
|
219
|
+
before(:each) do
|
220
|
+
|
221
|
+
|
222
|
+
@link = Insightly::Link.add_organisation(8936117, "Employeer", "Handles payment")
|
223
|
+
# @link = Insightly::Link.add_contacty(20315449,"Janitor", "Recent Hire")
|
224
|
+
end
|
225
|
+
it "should allow you to update an link" do
|
226
|
+
@opportunity.links.should == []
|
227
|
+
@opportunity.add_link(@link)
|
228
|
+
|
229
|
+
@opportunity.save
|
230
|
+
@link = @opportunity.links.first
|
231
|
+
@link.details = "Old Veteran"
|
232
|
+
@opportunity.links = [@link]
|
233
|
+
@opportunity.save
|
234
|
+
@opportunity.reload
|
235
|
+
@opportunity.links.length.should == 1
|
236
|
+
@opportunity.links.first.details.should == "Old Veteran"
|
237
|
+
end
|
238
|
+
it "should allow you to add an link" do
|
239
|
+
|
240
|
+
|
241
|
+
@opportunity.links.should == []
|
242
|
+
@opportunity.add_link(@link)
|
243
|
+
@opportunity.add_link(@link)
|
244
|
+
@opportunity.links.length.should == 2
|
245
|
+
@opportunity.save
|
246
|
+
@opportunity.reload
|
247
|
+
@opportunity.links.length.should == 1
|
248
|
+
@opportunity.links.first.details.should == "Handles payment"
|
249
|
+
end
|
250
|
+
it "should allow you to remove an link" do
|
251
|
+
|
252
|
+
@opportunity.links.should == []
|
253
|
+
@opportunity.add_link(@link)
|
254
|
+
|
255
|
+
@opportunity.save
|
256
|
+
@opportunity.links = []
|
257
|
+
@opportunity.save
|
258
|
+
@opportunity.reload
|
259
|
+
@opportunity.links.length.should == 0
|
260
|
+
|
261
|
+
end
|
262
|
+
it "should allow you to clear all links" do
|
263
|
+
@opportunity.links.should == []
|
264
|
+
@opportunity.add_link(@link)
|
265
|
+
|
266
|
+
@opportunity.save
|
267
|
+
@opportunity.links = []
|
268
|
+
@opportunity.save
|
269
|
+
@opportunity.reload
|
270
|
+
@opportunity.links.length.should == 0
|
271
|
+
end
|
272
|
+
end
|
273
|
+
context "Tags" do
|
274
|
+
before(:each) do
|
275
|
+
|
276
|
+
@tag = Insightly::Tag.build("Paying Customer")
|
277
|
+
@tag2 = Insightly::Tag.build("Freebie")
|
278
|
+
|
279
|
+
end
|
280
|
+
it "should allow you to update an tag" do
|
281
|
+
@opportunity.tags.should == []
|
282
|
+
@opportunity.add_tag(@tag)
|
283
|
+
@tags = @opportunity.tags
|
284
|
+
|
285
|
+
@opportunity.save
|
286
|
+
@tag = @opportunity.tags.first
|
287
|
+
@tag.tag_name = "Old Veteran"
|
288
|
+
@opportunity.tags = [@tag]
|
289
|
+
@opportunity.save
|
290
|
+
@opportunity.reload
|
291
|
+
@opportunity.tags.length.should == 1
|
292
|
+
@opportunity.tags.first.tag_name.should == "Old Veteran"
|
293
|
+
end
|
294
|
+
it "should allow you to add an tag" do
|
295
|
+
|
296
|
+
|
297
|
+
@opportunity.tags.should == []
|
298
|
+
@opportunity.add_tag(@tag)
|
299
|
+
@opportunity.add_tag(@tag)
|
300
|
+
@opportunity.tags.length.should == 2
|
301
|
+
@opportunity.save
|
302
|
+
@opportunity.reload
|
303
|
+
@opportunity.tags.length.should == 1
|
304
|
+
@opportunity.tags.first.tag_name.should == "Paying Customer"
|
305
|
+
end
|
306
|
+
it "should allow you to remove an tag" do
|
307
|
+
|
308
|
+
@opportunity.tags.should == []
|
309
|
+
@opportunity.add_tag(@tag)
|
310
|
+
|
311
|
+
@opportunity.save
|
312
|
+
@opportunity.tags = []
|
313
|
+
@opportunity.save
|
314
|
+
@opportunity.reload
|
315
|
+
@opportunity.tags.length.should == 0
|
316
|
+
|
317
|
+
end
|
318
|
+
it "should allow you to clear all tags" do
|
319
|
+
@opportunity.tags.should == []
|
320
|
+
@opportunity.add_tag(@tag)
|
321
|
+
|
322
|
+
@opportunity.save
|
323
|
+
@opportunity.tags = []
|
324
|
+
@opportunity.save
|
325
|
+
@opportunity.reload
|
326
|
+
@opportunity.tags.length.should == 0
|
327
|
+
end
|
328
|
+
end
|
329
|
+
end
|
268
330
|
end
|
@@ -51,189 +51,252 @@ describe Insightly::Organisation do
|
|
51
51
|
# @new_organisation = Insightly::Organisation.new(@organisation.remote_id)
|
52
52
|
# @new_organisation.organisation_name.should == @organisation.organisation_name
|
53
53
|
#end
|
54
|
-
context "
|
54
|
+
context "connections" do
|
55
55
|
before(:each) do
|
56
|
-
@org = Insightly::Organisation.new(8936117)
|
57
|
-
@org.addresses = []
|
58
|
-
@org.save
|
59
|
-
|
60
|
-
@address = Insightly::Address.new
|
61
|
-
@address.address_type = "Work"
|
62
|
-
@address.street = "123 Main St"
|
63
|
-
@address.city = "Indianpolis"
|
64
|
-
@address.state = "IN"
|
65
|
-
@address.postcode = "46112"
|
66
|
-
@address.country = "US"
|
67
|
-
end
|
68
|
-
it "should allow you to update an address" do
|
69
|
-
@org.addresses.should == []
|
70
|
-
@org.add_address(@address)
|
71
|
-
|
72
|
-
@org.save
|
73
|
-
@address.state = "TX"
|
74
|
-
@org.addresses = [@address]
|
75
|
-
@org.save
|
76
|
-
@org.reload
|
77
|
-
@org.addresses.length.should == 1
|
78
|
-
@org.addresses.first.state.should == "TX"
|
79
|
-
end
|
80
|
-
it "should allow you to add an address" do
|
81
|
-
|
82
|
-
|
83
|
-
@org.addresses.should == []
|
84
|
-
@org.add_address(@address)
|
85
|
-
|
86
|
-
@org.save
|
87
|
-
@org.reload
|
88
|
-
@org.addresses.length.should == 1
|
89
|
-
@org.addresses.first.street.should == "123 Main St"
|
90
|
-
end
|
91
|
-
it "should allow you to remove an address" do
|
92
|
-
|
93
|
-
@org.addresses.should == []
|
94
|
-
@org.add_address(@address)
|
95
|
-
|
96
|
-
@org.save
|
97
|
-
@org.addresses = []
|
98
|
-
@org.save
|
99
|
-
@org.reload
|
100
|
-
@org.addresses.length.should == 0
|
101
|
-
|
102
|
-
end
|
103
|
-
it "should allow you to clear all addresses" do
|
104
|
-
@org.addresses.should == []
|
105
|
-
@org.add_address(@address)
|
106
|
-
|
107
|
-
@org.save
|
108
|
-
@org.addresses = []
|
109
|
-
@org.save
|
110
|
-
@org.reload
|
111
|
-
@org.addresses.length.should == 0
|
112
|
-
end
|
113
56
|
|
114
|
-
it "should not add an address if the same address is already on the organization" do
|
115
57
|
|
116
|
-
@org.addresses.should == []
|
117
|
-
@org.add_address(@address)
|
118
|
-
|
119
|
-
@org.add_address(@address)
|
120
|
-
@org.addresses.length.should == 1
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
context "contact_infos" do
|
125
|
-
before(:each) do
|
126
58
|
@org = Insightly::Organisation.new(8936117)
|
59
|
+
@org.addresses = []
|
60
|
+
@org.tags = []
|
61
|
+
@org.links = []
|
127
62
|
@org.contact_infos = []
|
128
63
|
@org.save
|
129
|
-
|
130
|
-
@contact_info = Insightly::ContactInfo.new
|
131
|
-
@contact_info.type = "PHONE"
|
132
|
-
@contact_info.label = "Work"
|
133
|
-
@contact_info.subtype = nil
|
134
|
-
@contact_info.detail = "bob@aol.com"
|
135
|
-
|
136
64
|
end
|
137
|
-
it "should allow you to update an contact_info" do
|
138
|
-
@org.contact_infos.should == []
|
139
|
-
@org.add_contact_info(@contact_info)
|
140
65
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
66
|
+
context "addresses" do
|
67
|
+
before(:each) do
|
68
|
+
|
69
|
+
|
70
|
+
@address = Insightly::Address.new
|
71
|
+
@address.address_type = "Work"
|
72
|
+
@address.street = "123 Main St"
|
73
|
+
@address.city = "Indianpolis"
|
74
|
+
@address.state = "IN"
|
75
|
+
@address.postcode = "46112"
|
76
|
+
@address.country = "US"
|
77
|
+
end
|
78
|
+
it "should allow you to update an address" do
|
79
|
+
@org.addresses.should == []
|
80
|
+
@org.add_address(@address)
|
81
|
+
|
82
|
+
@org.save
|
83
|
+
@address.state = "TX"
|
84
|
+
@org.addresses = [@address]
|
85
|
+
@org.save
|
86
|
+
@org.reload
|
87
|
+
@org.addresses.length.should == 1
|
88
|
+
@org.addresses.first.state.should == "TX"
|
89
|
+
end
|
90
|
+
it "should allow you to add an address" do
|
91
|
+
|
92
|
+
|
93
|
+
@org.addresses.should == []
|
94
|
+
@org.add_address(@address)
|
95
|
+
|
96
|
+
@org.save
|
97
|
+
@org.reload
|
98
|
+
@org.addresses.length.should == 1
|
99
|
+
@org.addresses.first.street.should == "123 Main St"
|
100
|
+
end
|
101
|
+
it "should allow you to remove an address" do
|
102
|
+
|
103
|
+
@org.addresses.should == []
|
104
|
+
@org.add_address(@address)
|
105
|
+
|
106
|
+
@org.save
|
107
|
+
@org.addresses = []
|
108
|
+
@org.save
|
109
|
+
@org.reload
|
110
|
+
@org.addresses.length.should == 0
|
111
|
+
|
112
|
+
end
|
113
|
+
it "should allow you to clear all addresses" do
|
114
|
+
@org.addresses.should == []
|
115
|
+
@org.add_address(@address)
|
116
|
+
|
117
|
+
@org.save
|
118
|
+
@org.addresses = []
|
119
|
+
@org.save
|
120
|
+
@org.reload
|
121
|
+
@org.addresses.length.should == 0
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should not add an address if the same address is already on the organization" do
|
125
|
+
|
126
|
+
@org.addresses.should == []
|
127
|
+
@org.add_address(@address)
|
128
|
+
|
129
|
+
@org.add_address(@address)
|
130
|
+
@org.addresses.length.should == 1
|
131
|
+
end
|
148
132
|
end
|
149
|
-
it "should allow you to add an contact_info" do
|
150
133
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
134
|
+
context "contact_infos" do
|
135
|
+
before(:each) do
|
136
|
+
|
137
|
+
|
138
|
+
@contact_info = Insightly::ContactInfo.new
|
139
|
+
@contact_info.type = "PHONE"
|
140
|
+
@contact_info.label = "Work"
|
141
|
+
@contact_info.subtype = nil
|
142
|
+
@contact_info.detail = "bob@aol.com"
|
143
|
+
|
144
|
+
end
|
145
|
+
it "should allow you to update an contact_info" do
|
146
|
+
@org.contact_infos.should == []
|
147
|
+
@org.add_contact_info(@contact_info)
|
148
|
+
|
149
|
+
@org.save
|
150
|
+
@contact_info.detail = "bobroberts@aol.com"
|
151
|
+
@org.contact_infos = [@contact_info]
|
152
|
+
@org.save
|
153
|
+
@org.reload
|
154
|
+
@org.contact_infos.length.should == 1
|
155
|
+
@org.contact_infos.first.detail.should == "bobroberts@aol.com"
|
156
|
+
end
|
157
|
+
it "should allow you to add an contact_info" do
|
158
|
+
|
159
|
+
|
160
|
+
@org.contact_infos.should == []
|
161
|
+
@org.add_contact_info(@contact_info)
|
162
|
+
|
163
|
+
@org.save
|
164
|
+
@org.reload
|
165
|
+
@org.contact_infos.length.should == 1
|
166
|
+
@org.contact_infos.first.detail.should == "bob@aol.com"
|
167
|
+
end
|
168
|
+
it "should allow you to remove an contact_info" do
|
169
|
+
|
170
|
+
@org.contact_infos.should == []
|
171
|
+
@org.add_contact_info(@contact_info)
|
172
|
+
|
173
|
+
@org.save
|
174
|
+
@org.contact_infos = []
|
175
|
+
@org.save
|
176
|
+
@org.reload
|
177
|
+
@org.contact_infos.length.should == 0
|
178
|
+
|
179
|
+
end
|
180
|
+
it "should allow you to clear all contact_infos" do
|
181
|
+
@org.contact_infos.should == []
|
182
|
+
@org.add_contact_info(@contact_info)
|
183
|
+
|
184
|
+
@org.save
|
185
|
+
@org.contact_infos = []
|
186
|
+
@org.save
|
187
|
+
@org.reload
|
188
|
+
@org.contact_infos.length.should == 0
|
189
|
+
end
|
159
190
|
end
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
191
|
+
context "Links" do
|
192
|
+
before(:each) do
|
193
|
+
|
194
|
+
|
195
|
+
@link = Insightly::Link.add_contact(2982194, "Janitor", "Recent Hire")
|
196
|
+
# @link = Insightly::Link.add_opportunity(968613,"Janitor", "Recent Hire")
|
197
|
+
end
|
198
|
+
it "should allow you to update an link" do
|
199
|
+
@org.links.should == []
|
200
|
+
@org.add_link(@link)
|
201
|
+
|
202
|
+
@org.save
|
203
|
+
@link = @org.links.first
|
204
|
+
@link.details = "Old Veteran"
|
205
|
+
@org.links = [@link]
|
206
|
+
@org.save
|
207
|
+
@org.reload
|
208
|
+
@org.links.length.should == 1
|
209
|
+
@org.links.first.details.should == "Old Veteran"
|
210
|
+
end
|
211
|
+
it "should allow you to add an link" do
|
212
|
+
|
213
|
+
|
214
|
+
@org.links.should == []
|
215
|
+
@org.add_link(@link)
|
216
|
+
|
217
|
+
@org.save
|
218
|
+
@org.reload
|
219
|
+
@org.links.length.should == 1
|
220
|
+
@org.links.first.details.should == "Recent Hire"
|
221
|
+
end
|
222
|
+
it "should allow you to remove an link" do
|
223
|
+
|
224
|
+
@org.links.should == []
|
225
|
+
@org.add_link(@link)
|
226
|
+
|
227
|
+
@org.save
|
228
|
+
@org.links = []
|
229
|
+
@org.save
|
230
|
+
@org.reload
|
231
|
+
@org.links.length.should == 0
|
232
|
+
|
233
|
+
end
|
234
|
+
it "should allow you to clear all links" do
|
235
|
+
@org.links.should == []
|
236
|
+
@org.add_link(@link)
|
237
|
+
|
238
|
+
@org.save
|
239
|
+
@org.links = []
|
240
|
+
@org.save
|
241
|
+
@org.reload
|
242
|
+
@org.links.length.should == 0
|
243
|
+
end
|
171
244
|
end
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
245
|
+
context "Tags" do
|
246
|
+
before(:each) do
|
247
|
+
|
248
|
+
@tag = Insightly::Tag.build("Paying Customer")
|
249
|
+
@tag2 = Insightly::Tag.build("Freebie")
|
250
|
+
|
251
|
+
end
|
252
|
+
it "should allow you to update an tag" do
|
253
|
+
@org.tags.should == []
|
254
|
+
@org.add_tag(@tag)
|
255
|
+
@tags = @org.tags
|
256
|
+
|
257
|
+
@org.save
|
258
|
+
@tag = @org.tags.first
|
259
|
+
@tag.tag_name = "Old Veteran"
|
260
|
+
@org.tags = [@tag]
|
261
|
+
@org.save
|
262
|
+
@org.reload
|
263
|
+
@org.tags.length.should == 1
|
264
|
+
@org.tags.first.tag_name.should == "Old Veteran"
|
265
|
+
end
|
266
|
+
it "should allow you to add an tag" do
|
267
|
+
|
268
|
+
|
269
|
+
@org.tags.should == []
|
270
|
+
@org.add_tag(@tag)
|
271
|
+
@org.add_tag(@tag)
|
272
|
+
@org.tags.length.should == 2
|
273
|
+
@org.save
|
274
|
+
@org.reload
|
275
|
+
@org.tags.length.should == 1
|
276
|
+
@org.tags.first.tag_name.should == "Paying Customer"
|
277
|
+
end
|
278
|
+
it "should allow you to remove an tag" do
|
279
|
+
|
280
|
+
@org.tags.should == []
|
281
|
+
@org.add_tag(@tag)
|
282
|
+
|
283
|
+
@org.save
|
284
|
+
@org.tags = []
|
285
|
+
@org.save
|
286
|
+
@org.reload
|
287
|
+
@org.tags.length.should == 0
|
288
|
+
|
289
|
+
end
|
290
|
+
it "should allow you to clear all tags" do
|
291
|
+
@org.tags.should == []
|
292
|
+
@org.add_tag(@tag)
|
293
|
+
|
294
|
+
@org.save
|
295
|
+
@org.tags = []
|
296
|
+
@org.save
|
297
|
+
@org.reload
|
298
|
+
@org.tags.length.should == 0
|
299
|
+
end
|
181
300
|
end
|
182
301
|
end
|
183
|
-
context "Links" do
|
184
|
-
before(:each) do
|
185
|
-
@org = Insightly::Organisation.new(8936117)
|
186
|
-
@org.links = []
|
187
|
-
@org.save
|
188
|
-
|
189
|
-
@link = Insightly::Link.add_contact(2982194,"Janitor", "Recent Hire")
|
190
|
-
# @link = Insightly::Link.add_opportunity(968613,"Janitor", "Recent Hire")
|
191
|
-
end
|
192
|
-
it "should allow you to update an link" do
|
193
|
-
@org.links.should == []
|
194
|
-
@org.add_link(@link)
|
195
|
-
|
196
|
-
@org.save
|
197
|
-
@link = @org.links.first
|
198
|
-
@link.details = "Old Veteran"
|
199
|
-
@org.links = [@link]
|
200
|
-
@org.save
|
201
|
-
@org.reload
|
202
|
-
@org.links.length.should == 1
|
203
|
-
@org.links.first.details.should == "Old Veteran"
|
204
|
-
end
|
205
|
-
it "should allow you to add an link" do
|
206
|
-
|
207
|
-
|
208
|
-
@org.links.should == []
|
209
|
-
@org.add_link(@link)
|
210
|
-
|
211
|
-
@org.save
|
212
|
-
@org.reload
|
213
|
-
@org.links.length.should == 1
|
214
|
-
@org.links.first.details.should == "Recent Hire"
|
215
|
-
end
|
216
|
-
it "should allow you to remove an link" do
|
217
|
-
|
218
|
-
@org.links.should == []
|
219
|
-
@org.add_link(@link)
|
220
|
-
|
221
|
-
@org.save
|
222
|
-
@org.links = []
|
223
|
-
@org.save
|
224
|
-
@org.reload
|
225
|
-
@org.links.length.should == 0
|
226
|
-
|
227
|
-
end
|
228
|
-
it "should allow you to clear all links" do
|
229
|
-
@org.links.should == []
|
230
|
-
@org.add_link(@link)
|
231
|
-
|
232
|
-
@org.save
|
233
|
-
@org.links = []
|
234
|
-
@org.save
|
235
|
-
@org.reload
|
236
|
-
@org.links.length.should == 0
|
237
|
-
end
|
238
|
-
end
|
239
302
|
end
|