ppl 4.0.1 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +1 -0
- data/features/step_definitions/ppl_steps.rb +3 -3
- data/ppl.gemspec +1 -1
- data/spec/ppl/adapter/color/colored_spec.rb +3 -3
- data/spec/ppl/adapter/email_scraper/mail_spec.rb +13 -13
- data/spec/ppl/adapter/output_spec.rb +7 -7
- data/spec/ppl/adapter/storage/disk_spec.rb +18 -18
- data/spec/ppl/adapter/storage/factory_spec.rb +3 -3
- data/spec/ppl/adapter/storage/git_spec.rb +31 -31
- data/spec/ppl/adapter/storage_spec.rb +3 -3
- data/spec/ppl/adapter/vcard/greencard_spec.rb +45 -45
- data/spec/ppl/application/bootstrap_spec.rb +128 -128
- data/spec/ppl/application/command_spec.rb +8 -8
- data/spec/ppl/application/command_suite_spec.rb +7 -7
- data/spec/ppl/application/configuration_spec.rb +16 -16
- data/spec/ppl/application/input_spec.rb +2 -2
- data/spec/ppl/application/router_spec.rb +8 -8
- data/spec/ppl/application/shell_spec.rb +39 -39
- data/spec/ppl/command/add_spec.rb +6 -6
- data/spec/ppl/command/age_spec.rb +7 -7
- data/spec/ppl/command/attribute_spec.rb +22 -22
- data/spec/ppl/command/bday_spec.rb +11 -11
- data/spec/ppl/command/completion_spec.rb +7 -7
- data/spec/ppl/command/email_spec.rb +19 -19
- data/spec/ppl/command/external_spec.rb +7 -7
- data/spec/ppl/command/help_spec.rb +15 -15
- data/spec/ppl/command/init_spec.rb +5 -5
- data/spec/ppl/command/ls_spec.rb +12 -12
- data/spec/ppl/command/mutt_spec.rb +33 -33
- data/spec/ppl/command/mv_spec.rb +11 -11
- data/spec/ppl/command/name_spec.rb +17 -17
- data/spec/ppl/command/nick_spec.rb +1 -1
- data/spec/ppl/command/org_spec.rb +1 -1
- data/spec/ppl/command/phone_spec.rb +15 -15
- data/spec/ppl/command/post_spec.rb +29 -29
- data/spec/ppl/command/rm_spec.rb +3 -3
- data/spec/ppl/command/scrape_spec.rb +24 -24
- data/spec/ppl/command/shell_spec.rb +41 -41
- data/spec/ppl/command/show_spec.rb +4 -4
- data/spec/ppl/command/url_spec.rb +1 -1
- data/spec/ppl/command/version_spec.rb +4 -4
- data/spec/ppl/entity/address_book_spec.rb +1 -1
- data/spec/ppl/entity/contact_spec.rb +16 -16
- data/spec/ppl/entity/email_address_spec.rb +3 -3
- data/spec/ppl/entity/name_spec.rb +1 -1
- data/spec/ppl/entity/phone_number_spec.rb +5 -5
- data/spec/ppl/entity/postal_address_spec.rb +2 -2
- data/spec/ppl/format/address_book/ages_spec.rb +3 -3
- data/spec/ppl/format/address_book/birthdays_spec.rb +3 -3
- data/spec/ppl/format/address_book/email_addresses_spec.rb +3 -3
- data/spec/ppl/format/address_book/mutt_query_spec.rb +3 -3
- data/spec/ppl/format/address_book/names_spec.rb +3 -3
- data/spec/ppl/format/address_book/nicknames_spec.rb +4 -4
- data/spec/ppl/format/address_book/one_line_spec.rb +5 -5
- data/spec/ppl/format/address_book/organizations_spec.rb +3 -3
- data/spec/ppl/format/address_book/phone_numbers_spec.rb +3 -3
- data/spec/ppl/format/address_book/postal_addresses_spec.rb +2 -2
- data/spec/ppl/format/address_book/urls_spec.rb +3 -3
- data/spec/ppl/format/contact/age_spec.rb +8 -8
- data/spec/ppl/format/contact/birthday_spec.rb +4 -4
- data/spec/ppl/format/contact/email_addresses_spec.rb +3 -3
- data/spec/ppl/format/contact/full_spec.rb +11 -11
- data/spec/ppl/format/contact/nicknames_spec.rb +4 -4
- data/spec/ppl/format/contact/organization_spec.rb +4 -4
- data/spec/ppl/format/contact/phone_number_spec.rb +4 -4
- data/spec/ppl/format/contact/postal_address_spec.rb +1 -1
- data/spec/ppl/format/contact/postal_addresses_spec.rb +3 -3
- data/spec/ppl/format/contact/urls_spec.rb +4 -4
- data/spec/ppl/format/custom/contact_spec.rb +13 -13
- data/spec/ppl/format/custom/email_address_spec.rb +3 -3
- data/spec/ppl/format/custom/phone_number_spec.rb +4 -4
- data/spec/ppl/format/custom_spec.rb +6 -6
- data/spec/ppl/format/name/full_only_spec.rb +4 -4
- data/spec/ppl/format/postal_address/multi_line_spec.rb +10 -10
- data/spec/ppl/format/postal_address/one_line_spec.rb +9 -9
- data/spec/ppl/format/table_spec.rb +11 -11
- data/spec/ppl/service/email_address_spec.rb +13 -13
- data/spec/ppl/service/name_spec.rb +9 -9
- data/spec/ppl/service/phone_number_spec.rb +11 -11
- data/spec/ppl/service/postal_address_spec.rb +20 -20
- data/spec/spec_helper.rb +3 -0
- metadata +1 -1
@@ -31,13 +31,13 @@ describe Ppl::Adapter::Storage do
|
|
31
31
|
describe "#require_contact" do
|
32
32
|
|
33
33
|
it "should raise Ppl::Error::ContactNotFound if load fails" do
|
34
|
-
@storage.
|
34
|
+
allow(@storage).to receive(:load_contact) do |id| end
|
35
35
|
expect{@storage.require_contact("joe")}.to raise_error(Ppl::Error::ContactNotFound)
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should return the loaded contact" do
|
39
|
-
@storage.
|
40
|
-
@storage.require_contact("joe").
|
39
|
+
allow(@storage).to receive(:load_contact) do |id| Object.new end
|
40
|
+
expect(@storage.require_contact("joe")).to be_an(Object)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -11,70 +11,70 @@ describe Ppl::Adapter::Vcard::Vpim, "#encode" do
|
|
11
11
|
|
12
12
|
it "should encode the contact's birthday" do
|
13
13
|
@contact.birthday = Date.parse "2000-01-01"
|
14
|
-
@adapter.encode(@contact).
|
14
|
+
expect(@adapter.encode(@contact)).to include("BDAY:20000101")
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should encode the contact's full name" do
|
18
18
|
@contact.name.full = "John Doe"
|
19
|
-
@adapter.encode(@contact).
|
19
|
+
expect(@adapter.encode(@contact)).to include("FN:John Doe")
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should encode the contact's given name" do
|
23
23
|
@contact.name.given = "John"
|
24
|
-
@adapter.encode(@contact).
|
24
|
+
expect(@adapter.encode(@contact)).to include("N:;John;;;")
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should encode the contact's family name" do
|
28
28
|
@contact.name.family = "Smith"
|
29
|
-
@adapter.encode(@contact).
|
29
|
+
expect(@adapter.encode(@contact)).to include("N:Smith;;;;")
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should encode the contact's middle name" do
|
33
33
|
@contact.name.middle = "Quentin"
|
34
|
-
@adapter.encode(@contact).
|
34
|
+
expect(@adapter.encode(@contact)).to include("N:;;Quentin;;")
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should encode the contact's name prefix" do
|
38
38
|
@contact.name.prefix = "Mr."
|
39
|
-
@adapter.encode(@contact).
|
39
|
+
expect(@adapter.encode(@contact)).to include("N:;;;Mr.;")
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should encode the contact's name suffix" do
|
43
43
|
@contact.name.suffix = "BSc"
|
44
|
-
@adapter.encode(@contact).
|
44
|
+
expect(@adapter.encode(@contact)).to include("N:;;;;BSc")
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should encode the contact's email address" do
|
48
48
|
@contact.email_addresses << Ppl::Entity::EmailAddress.new("john@example.org")
|
49
|
-
@adapter.encode(@contact).
|
49
|
+
expect(@adapter.encode(@contact)).to include("EMAIL:john@example.org")
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should encode the contact's preferred email address as such" do
|
53
53
|
email_address = Ppl::Entity::EmailAddress.new("john@example.org")
|
54
54
|
email_address.preferred = true
|
55
55
|
@contact.email_addresses << email_address
|
56
|
-
@adapter.encode(@contact).
|
56
|
+
expect(@adapter.encode(@contact)).to include("EMAIL;TYPE=pref:john@example.org")
|
57
57
|
end
|
58
58
|
|
59
59
|
it "should encode the contact's phone number" do
|
60
60
|
@contact.phone_numbers << Ppl::Entity::PhoneNumber.new("01234567890")
|
61
|
-
@adapter.encode(@contact).
|
61
|
+
expect(@adapter.encode(@contact)).to include("TEL:01234567890")
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should encode the contact's preferred phone number as such" do
|
65
65
|
@contact.phone_numbers << Ppl::Entity::PhoneNumber.new("01234567890")
|
66
66
|
@contact.phone_numbers[0].preferred = true
|
67
|
-
@adapter.encode(@contact).
|
67
|
+
expect(@adapter.encode(@contact)).to include("TEL;TYPE=pref:01234567890")
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should encode the contact's phone number's type" do
|
71
71
|
@contact.phone_numbers << Ppl::Entity::PhoneNumber.new("01234567890", "cell")
|
72
|
-
@adapter.encode(@contact).
|
72
|
+
expect(@adapter.encode(@contact)).to include("TEL;TYPE=cell:01234567890")
|
73
73
|
end
|
74
74
|
|
75
75
|
it "should encode the contact's organization" do
|
76
76
|
@contact.organizations.push("Example Ltd")
|
77
|
-
@adapter.encode(@contact).
|
77
|
+
expect(@adapter.encode(@contact)).to include("ORG:Example Ltd")
|
78
78
|
end
|
79
79
|
|
80
80
|
describe "postal address encoding" do
|
@@ -86,54 +86,54 @@ describe Ppl::Adapter::Vcard::Vpim, "#encode" do
|
|
86
86
|
|
87
87
|
it "should encode the address id" do
|
88
88
|
@contact.postal_addresses[0].id = "home"
|
89
|
-
@adapter.encode(@contact).
|
89
|
+
expect(@adapter.encode(@contact)).to include("ADR;TYPE=home:;;;;;;")
|
90
90
|
end
|
91
91
|
|
92
92
|
it "should encode the preferred status of the address" do
|
93
93
|
@contact.postal_addresses[0].preferred = true
|
94
|
-
@adapter.encode(@contact).
|
94
|
+
expect(@adapter.encode(@contact)).to include("ADR;TYPE=pref:;;;;;;")
|
95
95
|
end
|
96
96
|
|
97
97
|
it "should encode the contact's street address" do
|
98
98
|
@contact.postal_addresses[0].street = "1 Testing Road"
|
99
|
-
@adapter.encode(@contact).
|
99
|
+
expect(@adapter.encode(@contact)).to include("ADR:;;1 Testing Road;;;;")
|
100
100
|
end
|
101
101
|
|
102
102
|
it "should encode the contact's postal code" do
|
103
103
|
@contact.postal_addresses[0].postal_code = "L7 8AA"
|
104
|
-
@adapter.encode(@contact).
|
104
|
+
expect(@adapter.encode(@contact)).to include("ADR:;;;;;L7 8AA;")
|
105
105
|
end
|
106
106
|
|
107
107
|
it "should encode the contact's po box" do
|
108
108
|
@contact.postal_addresses[0].po_box = "123456"
|
109
|
-
@adapter.encode(@contact).
|
109
|
+
expect(@adapter.encode(@contact)).to include("ADR:123456;;;;;;")
|
110
110
|
end
|
111
111
|
|
112
112
|
it "should encode the contact's locality" do
|
113
113
|
@contact.postal_addresses[0].locality = "Liverpool"
|
114
|
-
@adapter.encode(@contact).
|
114
|
+
expect(@adapter.encode(@contact)).to include("ADR:;;;Liverpool;;;")
|
115
115
|
end
|
116
116
|
|
117
117
|
it "should encode the contact's country" do
|
118
118
|
@contact.postal_addresses[0].country = "UK"
|
119
|
-
@adapter.encode(@contact).
|
119
|
+
expect(@adapter.encode(@contact)).to include("ADR:;;;;;;UK")
|
120
120
|
end
|
121
121
|
|
122
122
|
it "should encode the contact's region" do
|
123
123
|
@contact.postal_addresses[0].region = "South West"
|
124
|
-
@adapter.encode(@contact).
|
124
|
+
expect(@adapter.encode(@contact)).to include("ADR:;;;;South West;;")
|
125
125
|
end
|
126
126
|
|
127
127
|
end
|
128
128
|
|
129
129
|
it "should encode the contact's URL" do
|
130
130
|
@contact.urls.push "http://google.com"
|
131
|
-
@adapter.encode(@contact).
|
131
|
+
expect(@adapter.encode(@contact)).to include("URL:http://google.com")
|
132
132
|
end
|
133
133
|
|
134
134
|
it "should encode the contact's nickname" do
|
135
135
|
@contact.nicknames.push "Sleepy"
|
136
|
-
@adapter.encode(@contact).
|
136
|
+
expect(@adapter.encode(@contact)).to include("NICKNAME:Sleepy")
|
137
137
|
end
|
138
138
|
|
139
139
|
end
|
@@ -152,7 +152,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
152
152
|
"N:,test",
|
153
153
|
"END:VCARD",
|
154
154
|
].join("\n")
|
155
|
-
@adapter.decode(vcard).
|
155
|
+
expect(@adapter.decode(vcard)).to be_a(Ppl::Entity::Contact)
|
156
156
|
end
|
157
157
|
|
158
158
|
it "should decode the contact's birthday" do
|
@@ -163,7 +163,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
163
163
|
"BDAY:20120102",
|
164
164
|
"END:VCARD",
|
165
165
|
].join("\n")
|
166
|
-
@adapter.decode(vcard).birthday.strftime('%Y-%m-%d').
|
166
|
+
expect(@adapter.decode(vcard).birthday.strftime('%Y-%m-%d')).to eq "2012-01-02"
|
167
167
|
end
|
168
168
|
|
169
169
|
it "should decode the contact's name" do
|
@@ -177,7 +177,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
177
177
|
].join("\n")
|
178
178
|
contact = @adapter.decode(vcard)
|
179
179
|
|
180
|
-
contact.name.full.
|
180
|
+
expect(contact.name.full).to eq "John Doe"
|
181
181
|
end
|
182
182
|
|
183
183
|
it "should decode the contact's email address" do
|
@@ -189,7 +189,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
189
189
|
"END:VCARD",
|
190
190
|
].join("\n")
|
191
191
|
contact = @adapter.decode(vcard)
|
192
|
-
contact.email_addresses.first.address.
|
192
|
+
expect(contact.email_addresses.first.address).to eq "home@example.org"
|
193
193
|
end
|
194
194
|
|
195
195
|
it "should mark preferred email addresses as such" do
|
@@ -201,7 +201,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
201
201
|
"END:VCARD",
|
202
202
|
].join("\n")
|
203
203
|
contact = @adapter.decode(vcard)
|
204
|
-
contact.email_addresses.first.preferred.
|
204
|
+
expect(contact.email_addresses.first.preferred).to eq true
|
205
205
|
end
|
206
206
|
|
207
207
|
it "should decode the contact's phone number" do
|
@@ -214,7 +214,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
214
214
|
].join("\n")
|
215
215
|
contact = @adapter.decode(vcard)
|
216
216
|
phone_number = contact.phone_numbers.first
|
217
|
-
phone_number.number.
|
217
|
+
expect(phone_number.number).to eq "01234567890"
|
218
218
|
end
|
219
219
|
|
220
220
|
it "should mark preferred phone numbers as such" do
|
@@ -227,7 +227,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
227
227
|
].join("\n")
|
228
228
|
contact = @adapter.decode(vcard)
|
229
229
|
phone_number = contact.phone_numbers.first
|
230
|
-
phone_number.preferred.
|
230
|
+
expect(phone_number.preferred).to eq true
|
231
231
|
end
|
232
232
|
|
233
233
|
it "should decode the contact's phone number's type" do
|
@@ -240,7 +240,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
240
240
|
].join("\n")
|
241
241
|
contact = @adapter.decode(vcard)
|
242
242
|
phone_number = contact.phone_numbers.first
|
243
|
-
phone_number.type.
|
243
|
+
expect(phone_number.type).to eq "cell"
|
244
244
|
end
|
245
245
|
|
246
246
|
it "should decode the contact's phone number's nonstandard type" do
|
@@ -253,7 +253,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
253
253
|
].join("\n")
|
254
254
|
contact = @adapter.decode(vcard)
|
255
255
|
phone_number = contact.phone_numbers.first
|
256
|
-
phone_number.type.
|
256
|
+
expect(phone_number.type).to eq "testing"
|
257
257
|
end
|
258
258
|
|
259
259
|
it "should decode the contact's organization" do
|
@@ -265,7 +265,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
265
265
|
"END:VCARD",
|
266
266
|
].join("\n")
|
267
267
|
contact = @adapter.decode(vcard)
|
268
|
-
contact.organizations.first.
|
268
|
+
expect(contact.organizations.first).to eq "Example Ltd"
|
269
269
|
end
|
270
270
|
|
271
271
|
describe "postal address decoding" do
|
@@ -279,7 +279,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
279
279
|
"END:VCARD",
|
280
280
|
].join("\n")
|
281
281
|
contact = @adapter.decode(vcard)
|
282
|
-
contact.postal_addresses[0].id.
|
282
|
+
expect(contact.postal_addresses[0].id).to eq "home"
|
283
283
|
end
|
284
284
|
|
285
285
|
it "should decode the postal address' ID even if it's a nonstandard type" do
|
@@ -291,7 +291,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
291
291
|
"END:VCARD",
|
292
292
|
].join("\n")
|
293
293
|
contact = @adapter.decode(vcard)
|
294
|
-
contact.postal_addresses[0].id.
|
294
|
+
expect(contact.postal_addresses[0].id).to eq "nasa"
|
295
295
|
end
|
296
296
|
|
297
297
|
it "should assign the postal address a fallback ID if necessary" do
|
@@ -303,7 +303,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
303
303
|
"END:VCARD",
|
304
304
|
].join("\n")
|
305
305
|
contact = @adapter.decode(vcard)
|
306
|
-
contact.postal_addresses[0].id.
|
306
|
+
expect(contact.postal_addresses[0].id).to eq "910c67f"
|
307
307
|
end
|
308
308
|
|
309
309
|
it "should decode the contact's street address" do
|
@@ -315,7 +315,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
315
315
|
"END:VCARD",
|
316
316
|
].join("\n")
|
317
317
|
contact = @adapter.decode(vcard)
|
318
|
-
contact.postal_addresses[0].street.
|
318
|
+
expect(contact.postal_addresses[0].street).to eq "1 Testing Road"
|
319
319
|
end
|
320
320
|
|
321
321
|
it "should decode the contact's postal code" do
|
@@ -327,7 +327,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
327
327
|
"END:VCARD",
|
328
328
|
].join("\n")
|
329
329
|
contact = @adapter.decode(vcard)
|
330
|
-
contact.postal_addresses[0].postal_code.
|
330
|
+
expect(contact.postal_addresses[0].postal_code).to eq "L7 8AA"
|
331
331
|
end
|
332
332
|
|
333
333
|
it "should decode the contact's po box" do
|
@@ -339,7 +339,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
339
339
|
"END:VCARD",
|
340
340
|
].join("\n")
|
341
341
|
contact = @adapter.decode(vcard)
|
342
|
-
contact.postal_addresses[0].po_box.
|
342
|
+
expect(contact.postal_addresses[0].po_box).to eq "123456"
|
343
343
|
end
|
344
344
|
|
345
345
|
it "should decode the contact's locality" do
|
@@ -351,7 +351,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
351
351
|
"END:VCARD",
|
352
352
|
].join("\n")
|
353
353
|
contact = @adapter.decode(vcard)
|
354
|
-
contact.postal_addresses[0].locality.
|
354
|
+
expect(contact.postal_addresses[0].locality).to eq "Liverpool"
|
355
355
|
end
|
356
356
|
|
357
357
|
it "should decode the contact's region" do
|
@@ -363,7 +363,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
363
363
|
"END:VCARD",
|
364
364
|
].join("\n")
|
365
365
|
contact = @adapter.decode(vcard)
|
366
|
-
contact.postal_addresses[0].region.
|
366
|
+
expect(contact.postal_addresses[0].region).to eq "South West"
|
367
367
|
end
|
368
368
|
|
369
369
|
it "should decode the contact's country" do
|
@@ -375,7 +375,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
375
375
|
"END:VCARD",
|
376
376
|
].join("\n")
|
377
377
|
contact = @adapter.decode(vcard)
|
378
|
-
contact.postal_addresses[0].country.
|
378
|
+
expect(contact.postal_addresses[0].country).to eq "UK"
|
379
379
|
end
|
380
380
|
|
381
381
|
end
|
@@ -389,7 +389,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
389
389
|
"END:VCARD",
|
390
390
|
].join("\n")
|
391
391
|
contact = @adapter.decode(vcard)
|
392
|
-
contact.urls.first.
|
392
|
+
expect(contact.urls.first).to eq "http://google.com"
|
393
393
|
end
|
394
394
|
|
395
395
|
it "should decode the contact's nickame" do
|
@@ -401,7 +401,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
401
401
|
"END:VCARD",
|
402
402
|
].join("\n")
|
403
403
|
contact = @adapter.decode(vcard)
|
404
|
-
contact.nicknames.first.
|
404
|
+
expect(contact.nicknames.first).to eq "Happy"
|
405
405
|
end
|
406
406
|
|
407
407
|
it "should not choke on utf8" do
|
@@ -413,7 +413,7 @@ describe Ppl::Adapter::Vcard::Vpim, "#decode" do
|
|
413
413
|
"END:VCARD",
|
414
414
|
].join("\n")
|
415
415
|
contact = @adapter.decode(vcard)
|
416
|
-
contact.name.full.
|
416
|
+
expect(contact.name.full).to eq "Straße"
|
417
417
|
end
|
418
418
|
|
419
419
|
end
|
@@ -6,30 +6,30 @@ describe Ppl::Application::Bootstrap do
|
|
6
6
|
|
7
7
|
describe "#command_add" do
|
8
8
|
it "should return a Ppl::Command::Add" do
|
9
|
-
@bootstrap.command_add.
|
9
|
+
expect(@bootstrap.command_add).to be_a(Ppl::Command::Add)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
describe "#command_age" do
|
14
14
|
it "should return a Ppl::Command::Age" do
|
15
|
-
@bootstrap.command_age.
|
15
|
+
expect(@bootstrap.command_age).to be_a(Ppl::Command::Age)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
describe "#command_bday" do
|
20
20
|
it "should return a Ppl::Command::Bday" do
|
21
|
-
@bootstrap.command_bday.
|
21
|
+
expect(@bootstrap.command_bday).to be_a(Ppl::Command::Bday)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
describe "#command_completion" do
|
26
26
|
it "should return a Ppl::Command::Completion" do
|
27
|
-
@bootstrap.command_completion.
|
27
|
+
expect(@bootstrap.command_completion).to be_a(Ppl::Command::Completion)
|
28
28
|
end
|
29
29
|
it "should inject a completions directory" do
|
30
|
-
Ppl::Command::Completion.
|
30
|
+
allow(Ppl::Command::Completion).to receive(:new) do
|
31
31
|
completion = double(Ppl::Command::Completion)
|
32
|
-
completion.
|
32
|
+
expect(completion).to receive(:completions_directory=)
|
33
33
|
completion
|
34
34
|
end
|
35
35
|
@bootstrap.command_completion
|
@@ -38,141 +38,141 @@ describe Ppl::Application::Bootstrap do
|
|
38
38
|
|
39
39
|
describe "#command_email" do
|
40
40
|
it "should return a Ppl::Command::Email" do
|
41
|
-
@bootstrap.command_email.
|
41
|
+
expect(@bootstrap.command_email).to be_a(Ppl::Command::Email)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
describe "#command_grep" do
|
46
46
|
it "should return a command" do
|
47
|
-
@bootstrap.command_grep.
|
47
|
+
expect(@bootstrap.command_grep).to be_a(Ppl::Application::Command)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
describe "#command_help" do
|
52
52
|
it "should return a Ppl::Command::Help" do
|
53
|
-
@bootstrap.command_help.
|
53
|
+
expect(@bootstrap.command_help).to be_a(Ppl::Command::Help)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
describe "#command_init" do
|
58
58
|
it "should return a Ppl::Command::Init" do
|
59
|
-
@bootstrap.command_init.
|
59
|
+
expect(@bootstrap.command_init).to be_a(Ppl::Command::Init)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
describe "#command_ls" do
|
64
64
|
it "should return a Ppl::Command::Ls" do
|
65
|
-
@bootstrap.command_ls.
|
65
|
+
expect(@bootstrap.command_ls).to be_a(Ppl::Command::Ls)
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
69
|
describe "#command_mutt" do
|
70
70
|
it "should return a Ppl::Command::Mutt" do
|
71
|
-
@bootstrap.command_mutt.
|
71
|
+
expect(@bootstrap.command_mutt).to be_a(Ppl::Command::Mutt)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
75
|
describe "#command_mv" do
|
76
76
|
it "should return a Ppl::Command::Mv" do
|
77
|
-
@bootstrap.command_mv.
|
77
|
+
expect(@bootstrap.command_mv).to be_a(Ppl::Command::Mv)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
81
|
describe "#command_name" do
|
82
82
|
it "should return a Ppl::Command::Name" do
|
83
|
-
@bootstrap.command_name.
|
83
|
+
expect(@bootstrap.command_name).to be_a(Ppl::Command::Name)
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
87
|
describe "#command_nick" do
|
88
88
|
it "should return a Ppl::Command::Nick" do
|
89
|
-
@bootstrap.command_nick.
|
89
|
+
expect(@bootstrap.command_nick).to be_a(Ppl::Command::Nick)
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
93
|
describe "#command_org" do
|
94
94
|
it "should return a Ppl::Command::Org" do
|
95
|
-
@bootstrap.command_org.
|
95
|
+
expect(@bootstrap.command_org).to be_a(Ppl::Command::Org)
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
99
|
describe "#command_phone" do
|
100
100
|
it "should return a Ppl::Command::Phone" do
|
101
|
-
@bootstrap.command_phone.
|
101
|
+
expect(@bootstrap.command_phone).to be_a(Ppl::Command::Phone)
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
105
|
describe "#command_post" do
|
106
106
|
it "should return a Ppl::Command::Post" do
|
107
|
-
@bootstrap.command_post.
|
107
|
+
expect(@bootstrap.command_post).to be_a(Ppl::Command::Post)
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
111
|
describe "#command_pull" do
|
112
112
|
it "should return a command" do
|
113
|
-
@bootstrap.command_pull.
|
113
|
+
expect(@bootstrap.command_pull).to be_a(Ppl::Application::Command)
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
117
|
describe "#command_push" do
|
118
118
|
it "should return a command" do
|
119
|
-
@bootstrap.command_push.
|
119
|
+
expect(@bootstrap.command_push).to be_a(Ppl::Application::Command)
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
123
123
|
describe "#command_remote" do
|
124
124
|
it "should return a command" do
|
125
|
-
@bootstrap.command_remote.
|
125
|
+
expect(@bootstrap.command_remote).to be_a(Ppl::Application::Command)
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
129
|
describe "#command_rm" do
|
130
130
|
it "should return a Ppl::Command::Rm" do
|
131
|
-
@bootstrap.command_rm.
|
131
|
+
expect(@bootstrap.command_rm).to be_a(Ppl::Command::Rm)
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
135
|
describe "#command_scrape" do
|
136
136
|
it "should return a Ppl::Command::Scrape" do
|
137
|
-
@bootstrap.command_scrape.
|
137
|
+
expect(@bootstrap.command_scrape).to be_a(Ppl::Command::Scrape)
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
141
|
describe "#command_shell" do
|
142
142
|
it "should return a Ppl::Command::Shell" do
|
143
|
-
@bootstrap.command_shell.
|
143
|
+
expect(@bootstrap.command_shell).to be_a(Ppl::Command::Shell)
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
147
|
describe "#command_show" do
|
148
148
|
it "should return a Ppl::Command::Show" do
|
149
|
-
@bootstrap.command_show.
|
149
|
+
expect(@bootstrap.command_show).to be_a(Ppl::Command::Show)
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
153
153
|
describe "#command_url" do
|
154
154
|
it "should return a Ppl::Command::Url" do
|
155
|
-
@bootstrap.command_url.
|
155
|
+
expect(@bootstrap.command_url).to be_a(Ppl::Command::Url)
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
159
159
|
describe "#command_version" do
|
160
160
|
it "should return a Ppl::Command::Version" do
|
161
|
-
@bootstrap.command_version.
|
161
|
+
expect(@bootstrap.command_version).to be_a(Ppl::Command::Version)
|
162
162
|
end
|
163
163
|
end
|
164
164
|
|
165
165
|
describe "#format_address_book_ages" do
|
166
166
|
|
167
167
|
it "should return a Ppl::Format::AddressBook::Ages" do
|
168
|
-
@bootstrap.format_address_book_ages.
|
168
|
+
expect(@bootstrap.format_address_book_ages).to be_a(Ppl::Format::AddressBook::Ages)
|
169
169
|
end
|
170
170
|
|
171
171
|
it "should set up colored output if configured to do so" do
|
172
172
|
@colors = {}
|
173
173
|
@config = double(Ppl::Application::Configuration)
|
174
|
-
@bootstrap.
|
175
|
-
@config.
|
174
|
+
allow(@bootstrap).to receive(:configuration).and_return(@config)
|
175
|
+
expect(@config).to receive(:command_colors).with("age").and_return(@colors)
|
176
176
|
@bootstrap.format_address_book_ages
|
177
177
|
end
|
178
178
|
|
@@ -180,369 +180,369 @@ describe Ppl::Application::Bootstrap do
|
|
180
180
|
|
181
181
|
describe "#format_address_book_birthdays" do
|
182
182
|
it "should return a Ppl::Format::AddressBook::Birthdays" do
|
183
|
-
@bootstrap.format_address_book_birthdays.
|
183
|
+
expect(@bootstrap.format_address_book_birthdays).to be_a(Ppl::Format::AddressBook::Birthdays)
|
184
184
|
end
|
185
185
|
|
186
186
|
it "should set up colored output if configured to do so" do
|
187
187
|
@colors = {}
|
188
188
|
@config = double(Ppl::Application::Configuration)
|
189
|
-
@bootstrap.
|
190
|
-
@config.
|
189
|
+
allow(@bootstrap).to receive(:configuration).and_return(@config)
|
190
|
+
expect(@config).to receive(:command_colors).with("bday").and_return(@colors)
|
191
191
|
@bootstrap.format_address_book_birthdays
|
192
192
|
end
|
193
193
|
end
|
194
194
|
|
195
195
|
describe "#format_address_book_email_addresses" do
|
196
196
|
it "should return a Ppl::Format::AddressBook::EmailAddresses" do
|
197
|
-
@bootstrap.format_address_book_email_addresses.
|
197
|
+
expect(@bootstrap.format_address_book_email_addresses).to be_a(Ppl::Format::AddressBook::EmailAddresses)
|
198
198
|
end
|
199
199
|
it "should set up colored output if configured to do so" do
|
200
200
|
@colors = {}
|
201
201
|
@config = double(Ppl::Application::Configuration)
|
202
|
-
@bootstrap.
|
203
|
-
@config.
|
202
|
+
allow(@bootstrap).to receive(:configuration).and_return(@config)
|
203
|
+
expect(@config).to receive(:command_colors).with("email").and_return(@colors)
|
204
204
|
@bootstrap.format_address_book_email_addresses
|
205
205
|
end
|
206
206
|
end
|
207
207
|
|
208
208
|
describe "#format_address_book_mutt_query" do
|
209
209
|
it "should return a Ppl::Format::AddressBook::MuttQuery" do
|
210
|
-
@bootstrap.format_address_book_mutt_query.
|
210
|
+
expect(@bootstrap.format_address_book_mutt_query).to be_a(Ppl::Format::AddressBook::MuttQuery)
|
211
211
|
end
|
212
212
|
end
|
213
213
|
|
214
214
|
describe "#format_address_book_organizations" do
|
215
215
|
it "should return a Ppl::Format::AddressBook::Organizations" do
|
216
|
-
@bootstrap.format_address_book_organizations.
|
216
|
+
expect(@bootstrap.format_address_book_organizations).to be_a(Ppl::Format::AddressBook::Organizations)
|
217
217
|
end
|
218
218
|
it "should set up colored output if configured to do so" do
|
219
219
|
@colors = {}
|
220
220
|
@config = double(Ppl::Application::Configuration)
|
221
|
-
@bootstrap.
|
222
|
-
@config.
|
221
|
+
allow(@bootstrap).to receive(:configuration).and_return(@config)
|
222
|
+
expect(@config).to receive(:command_colors).with("org").and_return(@colors)
|
223
223
|
@bootstrap.format_address_book_organizations
|
224
224
|
end
|
225
225
|
end
|
226
226
|
|
227
227
|
describe "#format_address_book_names" do
|
228
228
|
it "should return a Ppl::Format::AddressBook::Names" do
|
229
|
-
@bootstrap.format_address_book_names.
|
229
|
+
expect(@bootstrap.format_address_book_names).to be_a(Ppl::Format::AddressBook::Names)
|
230
230
|
end
|
231
231
|
it "should set up colored output if configured to do so" do
|
232
232
|
@colors = {}
|
233
233
|
@config = double(Ppl::Application::Configuration)
|
234
|
-
@bootstrap.
|
235
|
-
@config.
|
234
|
+
allow(@bootstrap).to receive(:configuration).and_return(@config)
|
235
|
+
expect(@config).to receive(:command_colors).with("name").and_return(@colors)
|
236
236
|
@bootstrap.format_address_book_names
|
237
237
|
end
|
238
238
|
end
|
239
239
|
|
240
240
|
describe "#format_address_book_nicknames" do
|
241
241
|
it "should return a Ppl::Format::AddressBook::Nicknames" do
|
242
|
-
@bootstrap.format_address_book_nicknames.
|
242
|
+
expect(@bootstrap.format_address_book_nicknames).to be_a(Ppl::Format::AddressBook::Nicknames)
|
243
243
|
end
|
244
244
|
it "should set up colored output if configured to do so" do
|
245
245
|
@colors = {}
|
246
246
|
@config = double(Ppl::Application::Configuration)
|
247
|
-
@bootstrap.
|
248
|
-
@config.
|
247
|
+
allow(@bootstrap).to receive(:configuration).and_return(@config)
|
248
|
+
expect(@config).to receive(:command_colors).with("nick").and_return(@colors)
|
249
249
|
@bootstrap.format_address_book_nicknames
|
250
250
|
end
|
251
251
|
end
|
252
252
|
|
253
253
|
describe "#format_address_book_one_line" do
|
254
254
|
it "should return a Ppl::Format::AddressBook::OneLine" do
|
255
|
-
@bootstrap.format_address_book_one_line.
|
255
|
+
expect(@bootstrap.format_address_book_one_line).to be_a(Ppl::Format::AddressBook::OneLine)
|
256
256
|
end
|
257
257
|
it "should set up colored output if configured to do so" do
|
258
258
|
@colors = {}
|
259
259
|
@config = double(Ppl::Application::Configuration)
|
260
|
-
@bootstrap.
|
261
|
-
@config.
|
260
|
+
allow(@bootstrap).to receive(:configuration).and_return(@config)
|
261
|
+
expect(@config).to receive(:command_colors).with("ls").and_return(@colors)
|
262
262
|
@bootstrap.format_address_book_one_line
|
263
263
|
end
|
264
264
|
end
|
265
265
|
|
266
266
|
describe "#format_address_book_phone_numbers" do
|
267
267
|
it "should return a Ppl::Format::Address_book::PhoneNumbers" do
|
268
|
-
@bootstrap.format_address_book_phone_numbers.
|
268
|
+
expect(@bootstrap.format_address_book_phone_numbers).to be_a(Ppl::Format::AddressBook::PhoneNumbers)
|
269
269
|
end
|
270
270
|
it "should set up colored output if configured to do so" do
|
271
271
|
@colors = {}
|
272
272
|
@config = double(Ppl::Application::Configuration)
|
273
|
-
@bootstrap.
|
274
|
-
@config.
|
273
|
+
allow(@bootstrap).to receive(:configuration).and_return(@config)
|
274
|
+
expect(@config).to receive(:command_colors).with("phone").and_return(@colors)
|
275
275
|
@bootstrap.format_address_book_phone_numbers
|
276
276
|
end
|
277
277
|
end
|
278
278
|
|
279
279
|
describe "#format_address_book_postal_addresses" do
|
280
280
|
it "should return a Ppl::Format::AddressBook::PostalAddresses" do
|
281
|
-
@bootstrap.format_address_book_postal_addresses.
|
281
|
+
expect(@bootstrap.format_address_book_postal_addresses).to be_a(Ppl::Format::AddressBook::PostalAddresses)
|
282
282
|
end
|
283
283
|
it "should set up colored output if configured to do so" do
|
284
284
|
@colors = {}
|
285
285
|
@config = double(Ppl::Application::Configuration)
|
286
|
-
@bootstrap.
|
287
|
-
@config.
|
286
|
+
allow(@bootstrap).to receive(:configuration).and_return(@config)
|
287
|
+
expect(@config).to receive(:command_colors).with("post").and_return(@colors)
|
288
288
|
@bootstrap.format_address_book_postal_addresses
|
289
289
|
end
|
290
290
|
end
|
291
291
|
|
292
292
|
describe "#format_address_book_urls" do
|
293
293
|
it "should return a Ppl::Format::AddressBook::Urls" do
|
294
|
-
@bootstrap.format_address_book_urls.
|
294
|
+
expect(@bootstrap.format_address_book_urls).to be_a(Ppl::Format::AddressBook::Urls)
|
295
295
|
end
|
296
296
|
it "should set up colored output if configured to do so" do
|
297
297
|
@colors = {}
|
298
298
|
@config = double(Ppl::Application::Configuration)
|
299
|
-
@bootstrap.
|
300
|
-
@config.
|
299
|
+
allow(@bootstrap).to receive(:configuration).and_return(@config)
|
300
|
+
expect(@config).to receive(:command_colors).with("url").and_return(@colors)
|
301
301
|
@bootstrap.format_address_book_urls
|
302
302
|
end
|
303
303
|
end
|
304
304
|
|
305
305
|
describe "#format_contact_age" do
|
306
306
|
it "should return a Ppl::Format::Contact::Age" do
|
307
|
-
@bootstrap.format_contact_age.
|
307
|
+
expect(@bootstrap.format_contact_age).to be_a(Ppl::Format::Contact::Age)
|
308
308
|
end
|
309
309
|
it "should set up colored output if configured to do so" do
|
310
310
|
@colors = {}
|
311
311
|
@config = double(Ppl::Application::Configuration)
|
312
|
-
@bootstrap.
|
313
|
-
@config.
|
312
|
+
allow(@bootstrap).to receive(:configuration).and_return(@config)
|
313
|
+
expect(@config).to receive(:command_colors).with("age").and_return(@colors)
|
314
314
|
@bootstrap.format_contact_age
|
315
315
|
end
|
316
316
|
end
|
317
317
|
|
318
318
|
describe "#format_contact_birthday" do
|
319
319
|
it "should return a Ppl::Format::Contact::Birthday" do
|
320
|
-
@bootstrap.format_contact_birthday.
|
320
|
+
expect(@bootstrap.format_contact_birthday).to be_a(Ppl::Format::Contact::Birthday)
|
321
321
|
end
|
322
322
|
it "should set up colored output if configured to do so" do
|
323
323
|
@colors = {}
|
324
324
|
@config = double(Ppl::Application::Configuration)
|
325
|
-
@bootstrap.
|
326
|
-
@config.
|
325
|
+
allow(@bootstrap).to receive(:configuration).and_return(@config)
|
326
|
+
expect(@config).to receive(:command_colors).with("bday").and_return(@colors)
|
327
327
|
@bootstrap.format_contact_birthday
|
328
328
|
end
|
329
329
|
end
|
330
330
|
|
331
331
|
describe "#format_contact_email_addresses" do
|
332
332
|
it "should return a Ppl::Format::Contact::EmailAddresses" do
|
333
|
-
@bootstrap.format_contact_email_addresses.
|
333
|
+
expect(@bootstrap.format_contact_email_addresses).to be_a(Ppl::Format::Contact::EmailAddresses)
|
334
334
|
end
|
335
335
|
it "should set up colored output if configured to do so" do
|
336
336
|
@colors = {}
|
337
337
|
@config = double(Ppl::Application::Configuration)
|
338
|
-
@bootstrap.
|
339
|
-
@config.
|
338
|
+
allow(@bootstrap).to receive(:configuration).and_return(@config)
|
339
|
+
expect(@config).to receive(:command_colors).with("email").and_return(@colors)
|
340
340
|
@bootstrap.format_contact_email_addresses
|
341
341
|
end
|
342
342
|
end
|
343
343
|
|
344
344
|
describe "#format_name_full_only" do
|
345
345
|
it "should return a Ppl::Format::Contact::Name" do
|
346
|
-
@bootstrap.format_name_full_only.
|
346
|
+
expect(@bootstrap.format_name_full_only).to be_a(Ppl::Format::Name::FullOnly)
|
347
347
|
end
|
348
348
|
it "should set up colored output if configured to do so" do
|
349
349
|
@colors = {}
|
350
350
|
@config = double(Ppl::Application::Configuration)
|
351
|
-
@bootstrap.
|
352
|
-
@config.
|
351
|
+
allow(@bootstrap).to receive(:configuration).and_return(@config)
|
352
|
+
expect(@config).to receive(:command_colors).with("name").and_return(@colors)
|
353
353
|
@bootstrap.format_name_full_only
|
354
354
|
end
|
355
355
|
end
|
356
356
|
|
357
357
|
describe "#format_contact_nicknames" do
|
358
358
|
it "should return a Ppl::Format::Contact::Nicknames" do
|
359
|
-
@bootstrap.format_contact_nicknames.
|
359
|
+
expect(@bootstrap.format_contact_nicknames).to be_a(Ppl::Format::Contact::Nicknames)
|
360
360
|
end
|
361
361
|
it "should set up colored output if configured to do so" do
|
362
362
|
@colors = {}
|
363
363
|
@config = double(Ppl::Application::Configuration)
|
364
|
-
@bootstrap.
|
365
|
-
@config.
|
364
|
+
allow(@bootstrap).to receive(:configuration).and_return(@config)
|
365
|
+
expect(@config).to receive(:command_colors).with("nick").and_return(@colors)
|
366
366
|
@bootstrap.format_contact_nicknames
|
367
367
|
end
|
368
368
|
end
|
369
369
|
|
370
370
|
describe "#format_contact_organizations" do
|
371
371
|
it "should return a Ppl::Format::Contact::Organizations" do
|
372
|
-
@bootstrap.format_contact_organizations.
|
372
|
+
expect(@bootstrap.format_contact_organizations).to be_a(Ppl::Format::Contact::Organization)
|
373
373
|
end
|
374
374
|
it "should set up colored output if configured to do so" do
|
375
375
|
@colors = {}
|
376
376
|
@config = double(Ppl::Application::Configuration)
|
377
|
-
@bootstrap.
|
378
|
-
@config.
|
377
|
+
allow(@bootstrap).to receive(:configuration).and_return(@config)
|
378
|
+
expect(@config).to receive(:command_colors).with("org").and_return(@colors)
|
379
379
|
@bootstrap.format_contact_organizations
|
380
380
|
end
|
381
381
|
end
|
382
382
|
|
383
383
|
describe "#format_contact_phone_numbers" do
|
384
384
|
it "should return a Ppl::Format::Contact::PhoneNumber" do
|
385
|
-
@bootstrap.format_contact_phone_numbers.
|
385
|
+
expect(@bootstrap.format_contact_phone_numbers).to be_a(Ppl::Format::Contact::PhoneNumber)
|
386
386
|
end
|
387
387
|
it "should set up colored output if configured to do so" do
|
388
388
|
@colors = {}
|
389
389
|
@config = double(Ppl::Application::Configuration)
|
390
|
-
@bootstrap.
|
391
|
-
@config.
|
390
|
+
allow(@bootstrap).to receive(:configuration).and_return(@config)
|
391
|
+
expect(@config).to receive(:command_colors).with("phone").and_return(@colors)
|
392
392
|
@bootstrap.format_contact_phone_numbers
|
393
393
|
end
|
394
394
|
end
|
395
395
|
|
396
396
|
describe "#format_contact_postal_addresses" do
|
397
397
|
it "should return a Ppl::Format::Contact::PostalAddresses" do
|
398
|
-
@bootstrap.format_contact_postal_addresses.
|
398
|
+
expect(@bootstrap.format_contact_postal_addresses).to be_a(Ppl::Format::Contact::PostalAddresses)
|
399
399
|
end
|
400
400
|
end
|
401
401
|
|
402
402
|
describe "#format_contact_urls" do
|
403
403
|
it "should return a Ppl::Format::Contact::Urls" do
|
404
|
-
@bootstrap.format_contact_urls.
|
404
|
+
expect(@bootstrap.format_contact_urls).to be_a(Ppl::Format::Contact::Urls)
|
405
405
|
end
|
406
406
|
it "should set up colored output if configured to do so" do
|
407
407
|
@colors = {}
|
408
408
|
@config = double(Ppl::Application::Configuration)
|
409
|
-
@bootstrap.
|
410
|
-
@config.
|
409
|
+
allow(@bootstrap).to receive(:configuration).and_return(@config)
|
410
|
+
expect(@config).to receive(:command_colors).with("url").and_return(@colors)
|
411
411
|
@bootstrap.format_contact_urls
|
412
412
|
end
|
413
413
|
end
|
414
414
|
|
415
415
|
describe "#format_postal_address_multi_line" do
|
416
416
|
it "should return a Ppl::Format::PostalAddress::MultiLine" do
|
417
|
-
@bootstrap.format_postal_address_multi_line.
|
417
|
+
expect(@bootstrap.format_postal_address_multi_line).to be_a(Ppl::Format::PostalAddress::MultiLine)
|
418
418
|
end
|
419
419
|
end
|
420
420
|
|
421
421
|
describe "#command_suite" do
|
422
422
|
|
423
423
|
before(:each) do
|
424
|
-
@bootstrap.
|
424
|
+
allow(@bootstrap).to receive(:storage_adapter)
|
425
425
|
end
|
426
426
|
|
427
427
|
it "should return a Ppl::Application::CommandSuite" do
|
428
|
-
@bootstrap.command_suite.
|
428
|
+
expect(@bootstrap.command_suite).to be_a(Ppl::Application::CommandSuite)
|
429
429
|
end
|
430
430
|
it "should contain the 'add' command" do
|
431
|
-
@bootstrap.command_suite.find_command("add").
|
431
|
+
expect(@bootstrap.command_suite.find_command("add")).not_to be nil
|
432
432
|
end
|
433
433
|
it "should contain the 'age' command" do
|
434
|
-
@bootstrap.command_suite.find_command("age").
|
434
|
+
expect(@bootstrap.command_suite.find_command("age")).not_to be nil
|
435
435
|
end
|
436
436
|
it "should contain the 'bday' command" do
|
437
|
-
@bootstrap.command_suite.find_command("bday").
|
437
|
+
expect(@bootstrap.command_suite.find_command("bday")).not_to be nil
|
438
438
|
end
|
439
439
|
it "should contain the 'completion' command" do
|
440
|
-
@bootstrap.command_suite.find_command("completion").
|
440
|
+
expect(@bootstrap.command_suite.find_command("completion")).not_to be nil
|
441
441
|
end
|
442
442
|
it "should contain the 'email' command" do
|
443
|
-
@bootstrap.command_suite.find_command("email").
|
443
|
+
expect(@bootstrap.command_suite.find_command("email")).not_to be nil
|
444
444
|
end
|
445
445
|
it "should contain the 'grep' command" do
|
446
|
-
@bootstrap.command_suite.find_command("grep").
|
446
|
+
expect(@bootstrap.command_suite.find_command("grep")).not_to be nil
|
447
447
|
end
|
448
448
|
it "should contain the 'init' command" do
|
449
|
-
@bootstrap.command_suite.find_command("init").
|
449
|
+
expect(@bootstrap.command_suite.find_command("init")).not_to be nil
|
450
450
|
end
|
451
451
|
it "should contain the 'ls' command" do
|
452
|
-
@bootstrap.command_suite.find_command("ls").
|
452
|
+
expect(@bootstrap.command_suite.find_command("ls")).not_to be nil
|
453
453
|
end
|
454
454
|
it "should contain the 'mutt' command" do
|
455
|
-
@bootstrap.command_suite.find_command("mutt").
|
455
|
+
expect(@bootstrap.command_suite.find_command("mutt")).not_to be nil
|
456
456
|
end
|
457
457
|
it "should contain the 'mv' command" do
|
458
|
-
@bootstrap.command_suite.find_command("mv").
|
458
|
+
expect(@bootstrap.command_suite.find_command("mv")).not_to be nil
|
459
459
|
end
|
460
460
|
it "should contain the 'name' command" do
|
461
|
-
@bootstrap.command_suite.find_command("name").
|
461
|
+
expect(@bootstrap.command_suite.find_command("name")).not_to be nil
|
462
462
|
end
|
463
463
|
it "should contain the 'nick' command" do
|
464
|
-
@bootstrap.command_suite.find_command("nick").
|
464
|
+
expect(@bootstrap.command_suite.find_command("nick")).not_to be nil
|
465
465
|
end
|
466
466
|
it "should contain the 'org' command" do
|
467
|
-
@bootstrap.command_suite.find_command("org").
|
467
|
+
expect(@bootstrap.command_suite.find_command("org")).not_to be nil
|
468
468
|
end
|
469
469
|
it "should contain the 'phone' command" do
|
470
|
-
@bootstrap.command_suite.find_command("phone").
|
470
|
+
expect(@bootstrap.command_suite.find_command("phone")).not_to be nil
|
471
471
|
end
|
472
472
|
it "should contain the 'post' command" do
|
473
|
-
@bootstrap.command_suite.find_command("post").
|
473
|
+
expect(@bootstrap.command_suite.find_command("post")).not_to be nil
|
474
474
|
end
|
475
475
|
it "should contain the 'pull' command" do
|
476
|
-
@bootstrap.command_suite.find_command("pull").
|
476
|
+
expect(@bootstrap.command_suite.find_command("pull")).not_to be nil
|
477
477
|
end
|
478
478
|
it "should contain the 'push' command" do
|
479
|
-
@bootstrap.command_suite.find_command("push").
|
479
|
+
expect(@bootstrap.command_suite.find_command("push")).not_to be nil
|
480
480
|
end
|
481
481
|
it "should contain the 'remote' command" do
|
482
|
-
@bootstrap.command_suite.find_command("remote").
|
482
|
+
expect(@bootstrap.command_suite.find_command("remote")).not_to be nil
|
483
483
|
end
|
484
484
|
it "should contain the 'rm' command" do
|
485
|
-
@bootstrap.command_suite.find_command("rm").
|
485
|
+
expect(@bootstrap.command_suite.find_command("rm")).not_to be nil
|
486
486
|
end
|
487
487
|
it "should contain the 'scrape' command" do
|
488
|
-
@bootstrap.command_suite.find_command("scrape").
|
488
|
+
expect(@bootstrap.command_suite.find_command("scrape")).not_to be nil
|
489
489
|
end
|
490
490
|
it "should contain the 'show' command" do
|
491
|
-
@bootstrap.command_suite.find_command("show").
|
491
|
+
expect(@bootstrap.command_suite.find_command("show")).not_to be nil
|
492
492
|
end
|
493
493
|
it "should contain the 'help' command" do
|
494
|
-
@bootstrap.command_suite.find_command("help").
|
494
|
+
expect(@bootstrap.command_suite.find_command("help")).not_to be nil
|
495
495
|
end
|
496
496
|
it "should contain the 'shell' command" do
|
497
|
-
@bootstrap.command_suite.find_command("shell").
|
497
|
+
expect(@bootstrap.command_suite.find_command("shell")).not_to be nil
|
498
498
|
end
|
499
499
|
it "should contain the 'url' command" do
|
500
|
-
@bootstrap.command_suite.find_command("url").
|
500
|
+
expect(@bootstrap.command_suite.find_command("url")).not_to be nil
|
501
501
|
end
|
502
502
|
it "should contain the 'version' command" do
|
503
|
-
@bootstrap.command_suite.find_command("version").
|
503
|
+
expect(@bootstrap.command_suite.find_command("version")).not_to be nil
|
504
504
|
end
|
505
505
|
end
|
506
506
|
|
507
507
|
describe "#configuration" do
|
508
508
|
it "should return a Ppl::Application::Configuration" do
|
509
|
-
@bootstrap.configuration.
|
509
|
+
expect(@bootstrap.configuration).to be_a(Ppl::Application::Configuration)
|
510
510
|
end
|
511
511
|
end
|
512
512
|
|
513
513
|
describe "#input" do
|
514
514
|
it "should return a Ppl::Application::Input" do
|
515
|
-
@bootstrap.input.
|
515
|
+
expect(@bootstrap.input).to be_a(Ppl::Application::Input)
|
516
516
|
end
|
517
517
|
end
|
518
518
|
|
519
519
|
describe "#output" do
|
520
520
|
it "should return a Ppl::Application::Output" do
|
521
|
-
@bootstrap.output.
|
521
|
+
expect(@bootstrap.output).to be_a(Ppl::Application::Output)
|
522
522
|
end
|
523
523
|
end
|
524
524
|
|
525
525
|
describe "#router" do
|
526
526
|
before(:each) do
|
527
|
-
@bootstrap.
|
527
|
+
allow(@bootstrap).to receive(:storage_adapter)
|
528
528
|
end
|
529
529
|
it "should return a Ppl::Application::Router" do
|
530
|
-
@bootstrap.router.
|
530
|
+
expect(@bootstrap.router).to be_a(Ppl::Application::Router)
|
531
531
|
end
|
532
532
|
it "should set the 'help' command as the default" do
|
533
|
-
@bootstrap.router.default.
|
533
|
+
expect(@bootstrap.router.default).to eq "help"
|
534
534
|
end
|
535
535
|
it "should inject the user's aliases" do
|
536
|
-
@bootstrap.router.aliases.
|
536
|
+
expect(@bootstrap.router.aliases).to be_a(Hash)
|
537
537
|
end
|
538
538
|
end
|
539
539
|
|
540
540
|
describe "#shell" do
|
541
541
|
before(:each) do
|
542
|
-
@bootstrap.
|
542
|
+
allow(@bootstrap).to receive(:storage_adapter)
|
543
543
|
end
|
544
544
|
it "should return a Ppl::Application::Shell" do
|
545
|
-
@bootstrap.shell.
|
545
|
+
expect(@bootstrap.shell).to be_a(Ppl::Application::Shell)
|
546
546
|
end
|
547
547
|
end
|
548
548
|
|
@@ -550,32 +550,32 @@ describe Ppl::Application::Bootstrap do
|
|
550
550
|
before(:each) do
|
551
551
|
@config = double(Ppl::Application::Configuration)
|
552
552
|
@factory = double(Ppl::Adapter::Storage::Factory)
|
553
|
-
@bootstrap.
|
554
|
-
Ppl::Adapter::Storage::Factory.
|
553
|
+
allow(@bootstrap).to receive(:configuration).and_return(@config)
|
554
|
+
allow(Ppl::Adapter::Storage::Factory).to receive(:new).and_return(@factory)
|
555
555
|
|
556
|
-
@config.
|
557
|
-
@factory.
|
556
|
+
expect(@config).to receive(:address_book_path).and_return("/tmp")
|
557
|
+
expect(@factory).to receive(:load_adapter).and_return(Ppl::Adapter::Storage::Disk.new(nil))
|
558
558
|
end
|
559
559
|
it "should return a Ppl::Adapter::Storage" do
|
560
|
-
@bootstrap.storage_adapter.
|
560
|
+
expect(@bootstrap.storage_adapter).to be_a(Ppl::Adapter::Storage)
|
561
561
|
end
|
562
562
|
end
|
563
563
|
|
564
564
|
describe "#vcard_adapter" do
|
565
565
|
it "should return a Ppl::Adapter::Vcard::Vpim" do
|
566
|
-
@bootstrap.vcard_adapter.
|
566
|
+
expect(@bootstrap.vcard_adapter).to be_a(Ppl::Adapter::Vcard::Vpim)
|
567
567
|
end
|
568
568
|
end
|
569
569
|
|
570
570
|
describe "#name_service" do
|
571
571
|
it "should return a Ppl::Service::Name" do
|
572
|
-
@bootstrap.name_service.
|
572
|
+
expect(@bootstrap.name_service).to be_a(Ppl::Service::Name)
|
573
573
|
end
|
574
574
|
end
|
575
575
|
|
576
576
|
describe "#postal_address_service" do
|
577
577
|
it "should return a Ppl::Service::PostalAddress" do
|
578
|
-
@bootstrap.postal_address_service.
|
578
|
+
expect(@bootstrap.postal_address_service).to be_a(Ppl::Service::PostalAddress)
|
579
579
|
end
|
580
580
|
end
|
581
581
|
|