ppl 3.0.0 → 4.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.editorconfig +16 -0
- data/.eleventy.js +86 -0
- data/.eleventyignore +1 -0
- data/.github/workflows/build.yml +61 -0
- data/.gitignore +3 -1
- data/Rakefile +1 -18
- data/{CODE_OF_CONDUCT.md → code_of_conduct.md} +1 -1
- data/features/step_definitions/ppl_steps.rb +27 -27
- data/gh-pages/Gemfile +2 -0
- data/gh-pages/_config.yml +5 -0
- data/gh-pages/_includes/changelog.html +23 -0
- data/gh-pages/_includes/development-sidebar.html +25 -0
- data/gh-pages/_includes/footer.html +22 -0
- data/gh-pages/_includes/header.html +43 -0
- data/gh-pages/_includes/news.html +36 -0
- data/gh-pages/_includes/tip.html +54 -0
- data/gh-pages/_layouts/changelog.html +1 -0
- data/gh-pages/_layouts/command.html +104 -0
- data/gh-pages/_layouts/configuration.html +71 -0
- data/gh-pages/_layouts/development.html +20 -0
- data/gh-pages/_layouts/frontpage.html +6 -0
- data/gh-pages/_layouts/integration.html +44 -0
- data/gh-pages/_layouts/news.html +2 -0
- data/gh-pages/_layouts/page.html +6 -0
- data/gh-pages/_layouts/tip.html +2 -0
- data/gh-pages/_posts/2012-01-15-first-post.md +16 -0
- data/gh-pages/_posts/2012-12-20-1.0.0.md +19 -0
- data/gh-pages/_posts/2012-12-20-1.1.0.md +28 -0
- data/gh-pages/_posts/2012-12-20-1.2.0.md +18 -0
- data/gh-pages/_posts/2012-12-21-1.3.0.md +20 -0
- data/gh-pages/_posts/2012-12-21-thank-you-for-your-all-your-feedback.md +26 -0
- data/gh-pages/_posts/2012-12-22-1.4.1.md +21 -0
- data/gh-pages/_posts/2012-12-22-1.5.0.md +17 -0
- data/gh-pages/_posts/2012-12-23-1.5.1.md +13 -0
- data/gh-pages/_posts/2012-12-23-1.5.2.md +15 -0
- data/gh-pages/_posts/2012-12-26-1.5.3.md +19 -0
- data/gh-pages/_posts/2012-12-27-1.6.0.md +18 -0
- data/gh-pages/_posts/2012-12-29-1.7.0.md +18 -0
- data/gh-pages/_posts/2013-01-05-1.8.0.md +18 -0
- data/gh-pages/_posts/2013-01-06-1.9.0.md +20 -0
- data/gh-pages/_posts/2013-01-10-1.10.0.md +18 -0
- data/gh-pages/_posts/2013-01-20-1.11.0.md +14 -0
- data/gh-pages/_posts/2013-02-16-1.12.0.md +14 -0
- data/gh-pages/_posts/2013-02-17-1.13.0.md +29 -0
- data/gh-pages/_posts/2013-02-17-1.14.0.md +15 -0
- data/gh-pages/_posts/2013-02-17-1.14.1.md +18 -0
- data/gh-pages/_posts/2013-02-17-two-months-in.md +27 -0
- data/gh-pages/_posts/2013-03-16-1.15.0.md +28 -0
- data/gh-pages/_posts/2013-03-16-coloured-output-released.md +27 -0
- data/gh-pages/_posts/2013-04-10-ruby-2.0-compatibility.md +28 -0
- data/gh-pages/_posts/2013-04-11-1.15.1.md +13 -0
- data/gh-pages/_posts/2013-04-12-1.16.0.md +22 -0
- data/gh-pages/_posts/2013-04-14-1.17.0.md +15 -0
- data/gh-pages/_posts/2013-04-14-1.17.1.md +20 -0
- data/gh-pages/_posts/2013-04-14-1.17.2.md +13 -0
- data/gh-pages/_posts/2013-04-15-sync-alias.md +31 -0
- data/gh-pages/_posts/2013-04-15-utf8-fixed-and-more.md +37 -0
- data/gh-pages/_posts/2013-04-16-1.18.0.md +15 -0
- data/gh-pages/_posts/2013-04-16-set-up-color-output.md +47 -0
- data/gh-pages/_posts/2013-04-19-1.19.0.md +13 -0
- data/gh-pages/_posts/2013-04-19-1.20.0.md +15 -0
- data/gh-pages/_posts/2013-04-20-1.21.0.md +16 -0
- data/gh-pages/_posts/2013-04-20-1.22.0.md +14 -0
- data/gh-pages/_posts/2013-04-20-1.22.1.md +13 -0
- data/gh-pages/_posts/2013-04-21-1.22.2.md +15 -0
- data/gh-pages/_posts/2013-04-21-1.23.0.md +35 -0
- data/gh-pages/_posts/2013-04-23-1.24.0.md +16 -0
- data/gh-pages/_posts/2013-04-24-1.25.0.md +21 -0
- data/gh-pages/_posts/2013-05-09-2.0.0.md +33 -0
- data/gh-pages/_posts/2013-05-09-version-2.0.0-released.md +32 -0
- data/gh-pages/_posts/2013-07-20-2.1.0.md +36 -0
- data/gh-pages/_posts/2013-07-20-2.2.0.md +20 -0
- data/gh-pages/_posts/2013-10-12-2.3.0.md +19 -0
- data/gh-pages/_posts/2014-03-30-2.3.1.md +25 -0
- data/gh-pages/_posts/2015-01-05-2.3.2.md +18 -0
- data/gh-pages/_posts/2015-12-03-get-involved.md +29 -0
- data/gh-pages/_posts/2015-12-05-2.3.3.md +16 -0
- data/gh-pages/_posts/2016-01-02-2.4.0.md +19 -0
- data/gh-pages/_posts/2017-05-01-2.4.1.md +12 -0
- data/gh-pages/_posts/2017-10-23-sleep-mode.md +18 -0
- data/gh-pages/_posts/2018-01-03-3.0.1.md +12 -0
- data/gh-pages/_stylesheets/ppl/color.less +119 -0
- data/gh-pages/_stylesheets/ppl/layout.less +54 -0
- data/gh-pages/_stylesheets/ppl/style.less +185 -0
- data/gh-pages/_stylesheets/ppl/typography.less +59 -0
- data/gh-pages/development/changelog/index.md +18 -0
- data/gh-pages/development/changelog/split.rb +51 -0
- data/gh-pages/development/index.html +32 -0
- data/gh-pages/development/roadmap/index.md +15 -0
- data/gh-pages/documentation/about/index.html +63 -0
- data/gh-pages/documentation/commands/add/index.md +43 -0
- data/gh-pages/documentation/commands/age/add/index.md +40 -0
- data/gh-pages/documentation/commands/age/index.md +38 -0
- data/gh-pages/documentation/commands/bday/index.md +44 -0
- data/gh-pages/documentation/commands/completion/index.md +38 -0
- data/gh-pages/documentation/commands/email/index.md +64 -0
- data/gh-pages/documentation/commands/grep/index.md +32 -0
- data/gh-pages/documentation/commands/init/index.md +28 -0
- data/gh-pages/documentation/commands/ls/index.md +55 -0
- data/gh-pages/documentation/commands/mutt/index.md +36 -0
- data/gh-pages/documentation/commands/mv/index.md +26 -0
- data/gh-pages/documentation/commands/name/index.md +45 -0
- data/gh-pages/documentation/commands/nick/index.md +44 -0
- data/gh-pages/documentation/commands/org/index.md +45 -0
- data/gh-pages/documentation/commands/phone/index.md +56 -0
- data/gh-pages/documentation/commands/post/index.md +61 -0
- data/gh-pages/documentation/commands/pull/index.md +39 -0
- data/gh-pages/documentation/commands/push/index.md +36 -0
- data/gh-pages/documentation/commands/remote/index.md +40 -0
- data/gh-pages/documentation/commands/rm/index.md +23 -0
- data/gh-pages/documentation/commands/scrape/index.md +38 -0
- data/gh-pages/documentation/commands/shell/index.md +39 -0
- data/gh-pages/documentation/commands/show/index.md +33 -0
- data/gh-pages/documentation/commands/url/index.md +44 -0
- data/gh-pages/documentation/commands/version/index.md +27 -0
- data/gh-pages/documentation/configuration/address_book/index.md +22 -0
- data/gh-pages/documentation/configuration/alias/index.md +45 -0
- data/gh-pages/documentation/configuration/color/index.md +47 -0
- data/gh-pages/documentation/configuration/color_age/index.md +20 -0
- data/gh-pages/documentation/configuration/color_bday/index.md +20 -0
- data/gh-pages/documentation/configuration/color_email/index.md +21 -0
- data/gh-pages/documentation/configuration/color_ls/index.md +21 -0
- data/gh-pages/documentation/configuration/color_name/index.md +20 -0
- data/gh-pages/documentation/configuration/color_nick/index.md +20 -0
- data/gh-pages/documentation/configuration/color_org/index.md +20 -0
- data/gh-pages/documentation/configuration/color_phone/index.md +22 -0
- data/gh-pages/documentation/configuration/color_post/index.md +20 -0
- data/gh-pages/documentation/configuration/color_url/index.md +20 -0
- data/gh-pages/documentation/configuration/index.html +8 -0
- data/gh-pages/documentation/index.html +183 -0
- data/gh-pages/documentation/integration/bash/index.md +23 -0
- data/gh-pages/documentation/integration/google/index.md +26 -0
- data/gh-pages/documentation/integration/index.html +8 -0
- data/gh-pages/documentation/integration/mutt/index.md +35 -0
- data/gh-pages/documentation/integration/zsh/index.md +19 -0
- data/gh-pages/documentation/quick-start/index.html +88 -0
- data/gh-pages/documentation/tips/index.html +9 -0
- data/gh-pages/index.html +108 -0
- data/gh-pages/news/index.html +9 -0
- data/gh-pages/robots.txt +3 -0
- data/gh-pages/stylesheets/flatstrap.css +10 -0
- data/gh-pages/stylesheets/ppl.scss +235 -0
- data/gh-pages/wiki.png +0 -0
- data/lib/ppl.rb +4 -1
- data/lib/ppl/adapter/color.rb +0 -1
- data/lib/ppl/adapter/color/colored.rb +0 -1
- data/lib/ppl/adapter/email_scraper.rb +0 -1
- data/lib/ppl/adapter/email_scraper/mail.rb +4 -5
- data/lib/ppl/adapter/storage.rb +0 -1
- data/lib/ppl/adapter/storage/disk.rb +0 -1
- data/lib/ppl/adapter/storage/factory.rb +0 -1
- data/lib/ppl/adapter/vcard.rb +0 -1
- data/lib/ppl/adapter/vcard/vpim.rb +5 -1
- data/lib/ppl/application/bootstrap.rb +0 -1
- data/lib/ppl/application/command.rb +0 -1
- data/lib/ppl/application/command_suite.rb +0 -1
- data/lib/ppl/application/configuration.rb +0 -1
- data/lib/ppl/application/input.rb +0 -1
- data/lib/ppl/application/output.rb +0 -1
- data/lib/ppl/application/router.rb +0 -1
- data/lib/ppl/application/shell.rb +0 -1
- data/lib/ppl/command/add.rb +0 -1
- data/lib/ppl/command/age.rb +0 -1
- data/lib/ppl/command/attribute.rb +0 -1
- data/lib/ppl/command/bday.rb +0 -1
- data/lib/ppl/command/completion.rb +0 -1
- data/lib/ppl/command/email.rb +0 -1
- data/lib/ppl/command/external.rb +0 -1
- data/lib/ppl/command/help.rb +0 -1
- data/lib/ppl/command/init.rb +0 -1
- data/lib/ppl/command/ls.rb +0 -1
- data/lib/ppl/command/mutt.rb +0 -1
- data/lib/ppl/command/mv.rb +0 -1
- data/lib/ppl/command/name.rb +0 -1
- data/lib/ppl/command/nick.rb +0 -1
- data/lib/ppl/command/org.rb +0 -1
- data/lib/ppl/command/phone.rb +0 -1
- data/lib/ppl/command/post.rb +0 -1
- data/lib/ppl/command/rm.rb +0 -1
- data/lib/ppl/command/scrape.rb +0 -1
- data/lib/ppl/command/shell.rb +0 -1
- data/lib/ppl/command/show.rb +0 -1
- data/lib/ppl/command/url.rb +0 -1
- data/lib/ppl/command/version.rb +0 -1
- data/lib/ppl/entity/address_book.rb +0 -1
- data/lib/ppl/entity/contact.rb +0 -1
- data/lib/ppl/entity/email_address.rb +0 -1
- data/lib/ppl/entity/name.rb +0 -1
- data/lib/ppl/entity/phone_number.rb +0 -1
- data/lib/ppl/entity/postal_address.rb +0 -1
- data/lib/ppl/error/completion_not_found.rb +0 -1
- data/lib/ppl/error/contact_not_found.rb +0 -1
- data/lib/ppl/error/incorrect_usage.rb +0 -1
- data/lib/ppl/error/invalid_vcard.rb +1 -0
- data/lib/ppl/error/postal_address_not_found.rb +0 -1
- data/lib/ppl/format/address_book.rb +0 -1
- data/lib/ppl/format/address_book/ages.rb +0 -1
- data/lib/ppl/format/address_book/birthdays.rb +0 -1
- data/lib/ppl/format/address_book/email_addresses.rb +0 -1
- data/lib/ppl/format/address_book/mutt_query.rb +0 -1
- data/lib/ppl/format/address_book/names.rb +0 -1
- data/lib/ppl/format/address_book/nicknames.rb +0 -1
- data/lib/ppl/format/address_book/one_line.rb +0 -1
- data/lib/ppl/format/address_book/organizations.rb +0 -1
- data/lib/ppl/format/address_book/phone_numbers.rb +0 -1
- data/lib/ppl/format/address_book/postal_addresses.rb +0 -1
- data/lib/ppl/format/address_book/urls.rb +0 -1
- data/lib/ppl/format/contact.rb +0 -1
- data/lib/ppl/format/contact/age.rb +0 -1
- data/lib/ppl/format/contact/birthday.rb +0 -1
- data/lib/ppl/format/contact/email_addresses.rb +0 -1
- data/lib/ppl/format/contact/full.rb +0 -1
- data/lib/ppl/format/contact/nicknames.rb +0 -1
- data/lib/ppl/format/contact/organization.rb +0 -1
- data/lib/ppl/format/contact/phone_number.rb +0 -1
- data/lib/ppl/format/contact/postal_address.rb +0 -1
- data/lib/ppl/format/contact/postal_addresses.rb +0 -1
- data/lib/ppl/format/contact/urls.rb +0 -1
- data/lib/ppl/format/custom.rb +0 -1
- data/lib/ppl/format/custom/contact.rb +0 -1
- data/lib/ppl/format/custom/email_address.rb +0 -1
- data/lib/ppl/format/custom/phone_number.rb +0 -1
- data/lib/ppl/format/name.rb +0 -1
- data/lib/ppl/format/name/full_only.rb +0 -1
- data/lib/ppl/format/postal_address.rb +0 -1
- data/lib/ppl/format/postal_address/multi_line.rb +0 -1
- data/lib/ppl/format/postal_address/one_line.rb +0 -1
- data/lib/ppl/format/table.rb +0 -1
- data/lib/ppl/service/email_address.rb +0 -1
- data/lib/ppl/service/name.rb +0 -1
- data/lib/ppl/service/phone_number.rb +0 -1
- data/lib/ppl/service/postal_address.rb +0 -1
- data/{LICENSE → license} +0 -0
- data/makefile +18 -0
- data/package.json +23 -0
- data/ppl.gemspec +15 -13
- data/{README.md → readme.md} +12 -9
- data/site/_data/url.js +4 -0
- data/site/casts/hero.cast +189 -0
- data/site/development.njk +6 -0
- data/site/documentation.njk +6 -0
- data/site/index.njk +75 -0
- data/site/news.njk +6 -0
- data/site/style.scss +140 -0
- data/spec/ppl/adapter/color/colored_spec.rb +3 -4
- data/spec/ppl/adapter/color_spec.rb +0 -1
- data/spec/ppl/adapter/email_scraper/mail_spec.rb +13 -13
- data/spec/ppl/adapter/email_scraper_spec.rb +0 -1
- data/spec/ppl/adapter/output_spec.rb +7 -8
- data/spec/ppl/adapter/storage/disk_spec.rb +18 -19
- data/spec/ppl/adapter/storage/factory_spec.rb +3 -4
- data/spec/ppl/adapter/storage/git_spec.rb +31 -32
- data/spec/ppl/adapter/storage_spec.rb +3 -4
- data/spec/ppl/adapter/vcard/greencard_spec.rb +45 -45
- data/spec/ppl/adapter/vcard_spec.rb +0 -1
- data/spec/ppl/application/bootstrap_spec.rb +128 -129
- data/spec/ppl/application/command_spec.rb +8 -9
- data/spec/ppl/application/command_suite_spec.rb +7 -8
- data/spec/ppl/application/configuration_spec.rb +16 -17
- data/spec/ppl/application/input_spec.rb +2 -3
- data/spec/ppl/application/router_spec.rb +8 -9
- data/spec/ppl/application/shell_spec.rb +39 -40
- data/spec/ppl/command/add_spec.rb +6 -7
- data/spec/ppl/command/age_spec.rb +7 -8
- data/spec/ppl/command/attribute_spec.rb +22 -23
- data/spec/ppl/command/bday_spec.rb +11 -12
- data/spec/ppl/command/completion_spec.rb +7 -8
- data/spec/ppl/command/email_spec.rb +19 -20
- data/spec/ppl/command/external_spec.rb +7 -8
- data/spec/ppl/command/help_spec.rb +15 -16
- data/spec/ppl/command/init_spec.rb +5 -6
- data/spec/ppl/command/ls_spec.rb +12 -13
- data/spec/ppl/command/mutt_spec.rb +33 -34
- data/spec/ppl/command/mv_spec.rb +11 -12
- data/spec/ppl/command/name_spec.rb +17 -18
- data/spec/ppl/command/nick_spec.rb +1 -2
- data/spec/ppl/command/org_spec.rb +1 -2
- data/spec/ppl/command/phone_spec.rb +15 -16
- data/spec/ppl/command/post_spec.rb +29 -30
- data/spec/ppl/command/rm_spec.rb +3 -4
- data/spec/ppl/command/scrape_spec.rb +24 -25
- data/spec/ppl/command/shell_spec.rb +41 -42
- data/spec/ppl/command/show_spec.rb +4 -5
- data/spec/ppl/command/url_spec.rb +1 -2
- data/spec/ppl/command/version_spec.rb +4 -5
- data/spec/ppl/entity/address_book_spec.rb +1 -2
- data/spec/ppl/entity/contact_spec.rb +16 -17
- data/spec/ppl/entity/email_address_spec.rb +3 -4
- data/spec/ppl/entity/name_spec.rb +1 -2
- data/spec/ppl/entity/phone_number_spec.rb +5 -6
- data/spec/ppl/entity/postal_address_spec.rb +2 -3
- data/spec/ppl/format/address_book/ages_spec.rb +3 -4
- data/spec/ppl/format/address_book/birthdays_spec.rb +3 -4
- data/spec/ppl/format/address_book/email_addresses_spec.rb +3 -4
- data/spec/ppl/format/address_book/mutt_query_spec.rb +3 -4
- data/spec/ppl/format/address_book/names_spec.rb +3 -4
- data/spec/ppl/format/address_book/nicknames_spec.rb +4 -5
- data/spec/ppl/format/address_book/one_line_spec.rb +5 -6
- data/spec/ppl/format/address_book/organizations_spec.rb +3 -4
- data/spec/ppl/format/address_book/phone_numbers_spec.rb +3 -4
- data/spec/ppl/format/address_book/postal_addresses_spec.rb +2 -3
- data/spec/ppl/format/address_book/urls_spec.rb +3 -4
- data/spec/ppl/format/address_book_spec.rb +0 -1
- data/spec/ppl/format/contact/age_spec.rb +8 -9
- data/spec/ppl/format/contact/birthday_spec.rb +4 -5
- data/spec/ppl/format/contact/email_addresses_spec.rb +3 -4
- data/spec/ppl/format/contact/full_spec.rb +11 -12
- data/spec/ppl/format/contact/nicknames_spec.rb +4 -5
- data/spec/ppl/format/contact/organization_spec.rb +4 -5
- data/spec/ppl/format/contact/phone_number_spec.rb +4 -5
- data/spec/ppl/format/contact/postal_address_spec.rb +1 -2
- data/spec/ppl/format/contact/postal_addresses_spec.rb +3 -4
- data/spec/ppl/format/contact/urls_spec.rb +4 -5
- data/spec/ppl/format/contact_spec.rb +0 -1
- data/spec/ppl/format/custom/contact_spec.rb +13 -14
- data/spec/ppl/format/custom/email_address_spec.rb +3 -4
- data/spec/ppl/format/custom/phone_number_spec.rb +4 -5
- data/spec/ppl/format/custom_spec.rb +6 -7
- data/spec/ppl/format/name/full_only_spec.rb +4 -5
- data/spec/ppl/format/name_spec.rb +0 -1
- data/spec/ppl/format/postal_address/multi_line_spec.rb +10 -11
- data/spec/ppl/format/postal_address/one_line_spec.rb +9 -10
- data/spec/ppl/format/postal_address_spec.rb +0 -1
- data/spec/ppl/format/table_spec.rb +11 -11
- data/spec/ppl/service/email_address_spec.rb +13 -14
- data/spec/ppl/service/name_spec.rb +9 -10
- data/spec/ppl/service/phone_number_spec.rb +11 -12
- data/spec/ppl/service/postal_address_spec.rb +20 -21
- data/spec/spec_helper.rb +4 -0
- data/yarn.lock +3605 -0
- metadata +183 -22
- data/.travis.yml +0 -11
- data/COPYING +0 -339
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe "Ppl::Format::Custom" do
|
3
2
|
|
4
3
|
describe "::format" do
|
@@ -9,13 +8,13 @@ describe "Ppl::Format::Custom" do
|
|
9
8
|
|
10
9
|
describe "::process" do
|
11
10
|
it "should use the block passed to ::format to process the object" do
|
12
|
-
Ppl::Format::Custom::process(:N, {:name => "jdoe"}).
|
11
|
+
expect(Ppl::Format::Custom::process(:N, {:name => "jdoe"})).to eq "jdoe"
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
16
15
|
describe "#initialize" do
|
17
16
|
it "should accept a format string" do
|
18
|
-
Ppl::Format::Custom.new("%N").format.
|
17
|
+
expect(Ppl::Format::Custom.new("%N").format).to eq "%N"
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|
@@ -23,17 +22,17 @@ describe "Ppl::Format::Custom" do
|
|
23
22
|
it "should convert the given object into a string based on the format" do
|
24
23
|
custom = Ppl::Format::Custom.new("%N %N %N")
|
25
24
|
object = { :name => "jdoe" }
|
26
|
-
custom.process(object).
|
25
|
+
expect(custom.process(object)).to eq "jdoe jdoe jdoe"
|
27
26
|
end
|
28
27
|
it "should pad with leading spaces if a positive width is given" do
|
29
28
|
custom = Ppl::Format::Custom.new("%10N")
|
30
29
|
object = { :name => "jdoe" }
|
31
|
-
custom.process(object).
|
30
|
+
expect(custom.process(object)).to eq " jdoe"
|
32
31
|
end
|
33
32
|
it "should pad with trailing spaces if a negative width is given" do
|
34
33
|
custom = Ppl::Format::Custom.new("%-10N")
|
35
34
|
object = { :name => "jdoe" }
|
36
|
-
custom.process(object).
|
35
|
+
expect(custom.process(object)).to eq "jdoe "
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
@@ -42,7 +41,7 @@ describe "Ppl::Format::Custom" do
|
|
42
41
|
custom = Ppl::Format::Custom.new
|
43
42
|
custom.preset_formats = { "example" => "%N (%N)" }
|
44
43
|
custom.use_preset "example"
|
45
|
-
custom.process({:name => "a"}).
|
44
|
+
expect(custom.process({:name => "a"})).to eq "a (a)"
|
46
45
|
end
|
47
46
|
end
|
48
47
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Format::Name::FullOnly do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -11,18 +10,18 @@ describe Ppl::Format::Name::FullOnly do
|
|
11
10
|
describe "#process" do
|
12
11
|
|
13
12
|
it "should return an empty string if the contact lacks a name" do
|
14
|
-
@format.process(@name).
|
13
|
+
expect(@format.process(@name)).to eq ""
|
15
14
|
end
|
16
15
|
|
17
16
|
it "should return just the full name" do
|
18
17
|
@name.full = "John Doe"
|
19
|
-
@format.process(@name).
|
18
|
+
expect(@format.process(@name)).to eq "John Doe"
|
20
19
|
end
|
21
20
|
|
22
21
|
it "should colorize the string if configured to do so" do
|
23
22
|
@format.colors = { "name" => "blue" }
|
24
|
-
@color.
|
25
|
-
@format.process(@name).
|
23
|
+
expect(@color).to receive(:colorize).and_return("name in blue")
|
24
|
+
expect(@format.process(@name)).to eq "name in blue"
|
26
25
|
end
|
27
26
|
|
28
27
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Format::PostalAddress::MultiLine do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -22,12 +21,12 @@ describe Ppl::Format::PostalAddress::MultiLine do
|
|
22
21
|
|
23
22
|
it "outputs each address attribute on its own line" do
|
24
23
|
@lines = @format.process(@address).split "\n"
|
25
|
-
@lines[0].
|
26
|
-
@lines[1].
|
27
|
-
@lines[2].
|
28
|
-
@lines[3].
|
29
|
-
@lines[4].
|
30
|
-
@lines[5].
|
24
|
+
expect(@lines[0]).to eq "123 Happy Lane"
|
25
|
+
expect(@lines[1]).to eq "Bristol"
|
26
|
+
expect(@lines[2]).to eq "A very nice region indeed"
|
27
|
+
expect(@lines[3]).to eq "United Kingdom"
|
28
|
+
expect(@lines[4]).to eq "12345"
|
29
|
+
expect(@lines[5]).to eq "BS1 1SB"
|
31
30
|
end
|
32
31
|
|
33
32
|
end
|
@@ -43,10 +42,10 @@ describe Ppl::Format::PostalAddress::MultiLine do
|
|
43
42
|
|
44
43
|
it "doesn't output superfluous blank lines" do
|
45
44
|
@lines = @format.process(@address).split "\n"
|
46
|
-
@lines.length.
|
47
|
-
@lines[0].
|
48
|
-
@lines[1].
|
49
|
-
@lines[2].
|
45
|
+
expect(@lines.length).to eq 3
|
46
|
+
expect(@lines[0]).to eq "123 Happy Lane"
|
47
|
+
expect(@lines[1]).to eq "Bristol"
|
48
|
+
expect(@lines[2]).to eq "United Kingdom"
|
50
49
|
end
|
51
50
|
|
52
51
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Format::PostalAddress::OneLine do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -20,35 +19,35 @@ describe Ppl::Format::PostalAddress::OneLine do
|
|
20
19
|
end
|
21
20
|
|
22
21
|
it "inserts a blank 'star' column" do
|
23
|
-
@table.
|
22
|
+
expect(@table).to receive(:add_row) { |r| expect(r[:star]).to eq " " }
|
24
23
|
end
|
25
24
|
|
26
25
|
it "marks preferred addresses with a star" do
|
27
26
|
@address.preferred = true
|
28
|
-
@table.
|
27
|
+
expect(@table).to receive(:add_row) { |r| expect(r[:star]).to eq "*" }
|
29
28
|
end
|
30
29
|
|
31
30
|
it "puts the ID in its own column" do
|
32
|
-
@table.
|
31
|
+
expect(@table).to receive(:add_row) { |r| expect(r[:address_id]).to eq "home" }
|
33
32
|
end
|
34
33
|
|
35
34
|
it "concatenates the rest of the address in its own column" do
|
36
35
|
@address.country = nil
|
37
|
-
@table.
|
38
|
-
row[:address_text].
|
36
|
+
expect(@table).to receive(:add_row) do |row|
|
37
|
+
expect(row[:address_text]).to eq "123 Happy Lane"
|
39
38
|
end
|
40
39
|
end
|
41
40
|
|
42
41
|
it "separates address elements with commas" do
|
43
|
-
@table.
|
44
|
-
row[:address_text].
|
42
|
+
expect(@table).to receive(:add_row) do |row|
|
43
|
+
expect(row[:address_text]).to eq "123 Happy Lane, United Kingdom"
|
45
44
|
end
|
46
45
|
end
|
47
46
|
|
48
47
|
it "prunes elements that are empty" do
|
49
48
|
@address.country = ""
|
50
|
-
@table.
|
51
|
-
row[:address_text].
|
49
|
+
expect(@table).to receive(:add_row) do |row|
|
50
|
+
expect(row[:address_text]).to eq "123 Happy Lane"
|
52
51
|
end
|
53
52
|
end
|
54
53
|
|
@@ -9,7 +9,7 @@ describe Ppl::Format::Table do
|
|
9
9
|
:name,
|
10
10
|
:email,
|
11
11
|
])
|
12
|
-
@table.columns.length.
|
12
|
+
expect(@table.columns.length).to eq 3
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -27,7 +27,7 @@ describe Ppl::Format::Table do
|
|
27
27
|
|
28
28
|
describe "#colors" do
|
29
29
|
it "should be a hash" do
|
30
|
-
@table.colors.
|
30
|
+
expect(@table.colors).to be_a(Hash)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -38,14 +38,14 @@ describe Ppl::Format::Table do
|
|
38
38
|
:name => "John Doe",
|
39
39
|
:email => "jdoe@example.org",
|
40
40
|
})
|
41
|
-
@table.rows.length.
|
41
|
+
expect(@table.rows.length).to eq 1
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
describe "#to_s" do
|
46
46
|
|
47
47
|
it "should return an empty string if the table is empty" do
|
48
|
-
@table.to_s.
|
48
|
+
expect(@table.to_s).to eq ""
|
49
49
|
end
|
50
50
|
|
51
51
|
it "should return a string represenation of its rows" do
|
@@ -54,7 +54,7 @@ describe Ppl::Format::Table do
|
|
54
54
|
:name => "John Doe",
|
55
55
|
:email => "jdoe@example.org",
|
56
56
|
})
|
57
|
-
@table.to_s.
|
57
|
+
expect(@table.to_s).to eq "12345 John Doe jdoe@example.org"
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should use tabs if requested" do
|
@@ -64,7 +64,7 @@ describe Ppl::Format::Table do
|
|
64
64
|
:email => "jdoe@example.org",
|
65
65
|
})
|
66
66
|
@table.separator = Ppl::Format::Table::SEPARATOR_TABS
|
67
|
-
@table.to_s.
|
67
|
+
expect(@table.to_s).to eq "12345\tJohn Doe\tjdoe@example.org"
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should colorize columns if requested" do
|
@@ -78,7 +78,7 @@ describe Ppl::Format::Table do
|
|
78
78
|
:name => "John Doe",
|
79
79
|
:email => "jdoe@example.org",
|
80
80
|
})
|
81
|
-
@table.to_s.
|
81
|
+
expect(@table.to_s).to eq "\e[31m12345 \e[0m\e[33mJohn Doe \e[0m\e[34mjdoe@example.org \e[0m"
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should align multiple rows into neat columns" do
|
@@ -93,8 +93,8 @@ describe Ppl::Format::Table do
|
|
93
93
|
:email => "lula@planalto.biz",
|
94
94
|
})
|
95
95
|
|
96
|
-
@table.to_s.
|
97
|
-
@table.to_s.
|
96
|
+
expect(@table.to_s).to include "12345 John Doe jdoe@example.org"
|
97
|
+
expect(@table.to_s).to include "123 Luis Ignacio Lula da Silva lula@planalto.biz"
|
98
98
|
end
|
99
99
|
|
100
100
|
it "copes with mixed encodings" do
|
@@ -104,7 +104,7 @@ describe Ppl::Format::Table do
|
|
104
104
|
:email => "fv@example.org",
|
105
105
|
})
|
106
106
|
expect{ @table.to_s }.not_to raise_error()
|
107
|
-
@table.to_s.
|
107
|
+
expect(@table.to_s).to include "franz_viehböck Franz Viehböck fv@example.org"
|
108
108
|
end
|
109
109
|
|
110
110
|
end
|
@@ -122,7 +122,7 @@ describe Ppl::Format::Table do
|
|
122
122
|
:email => "jdoe@example.org",
|
123
123
|
})
|
124
124
|
@table.disable_colors!
|
125
|
-
@table.to_s.
|
125
|
+
expect(@table.to_s).to eq "12345 John Doe jdoe@example.org"
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
@@ -1,11 +1,10 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Service::EmailAddress do
|
3
2
|
|
4
3
|
before(:each) do
|
5
4
|
@service = Ppl::Service::EmailAddress.new
|
6
5
|
@contact = Ppl::Entity::Contact.new
|
7
6
|
@storage = double(Ppl::Adapter::Storage)
|
8
|
-
@storage.
|
7
|
+
allow(@storage).to receive(:save_contact)
|
9
8
|
@service.storage = @storage
|
10
9
|
@contact.email_addresses << Ppl::Entity::EmailAddress.new("one@example.org")
|
11
10
|
end
|
@@ -13,19 +12,19 @@ describe Ppl::Service::EmailAddress do
|
|
13
12
|
describe "#add" do
|
14
13
|
|
15
14
|
it "should add the email address to the contact" do
|
16
|
-
@storage.
|
17
|
-
contact.email_addresses[1].address.
|
15
|
+
allow(@storage).to receive(:save_contact) do |contact|
|
16
|
+
expect(contact.email_addresses[1].address).to eq "two@example.org"
|
18
17
|
end
|
19
18
|
@service.add(@contact, "two@example.org", {})
|
20
19
|
end
|
21
20
|
|
22
21
|
it "should set the new address as preferred if asked" do
|
23
22
|
@service.add(@contact, "two@example.org", {:preferred => true})
|
24
|
-
@contact.email_addresses[1].preferred.
|
23
|
+
expect(@contact.email_addresses[1].preferred).to eq true
|
25
24
|
end
|
26
25
|
|
27
26
|
it "should store the contact" do
|
28
|
-
@storage.
|
27
|
+
expect(@storage).to receive(:save_contact).with(@contact)
|
29
28
|
@service.add(@contact, "", {})
|
30
29
|
end
|
31
30
|
|
@@ -33,21 +32,21 @@ describe Ppl::Service::EmailAddress do
|
|
33
32
|
|
34
33
|
describe "#update" do
|
35
34
|
it "should store the updated contact" do
|
36
|
-
@storage.
|
35
|
+
expect(@storage).to receive(:save_contact).with(@contact)
|
37
36
|
@service.update(@contact, "", {})
|
38
37
|
end
|
39
38
|
|
40
39
|
it "should mark the address as preferred if asked to" do
|
41
|
-
@storage.
|
42
|
-
contact.email_addresses.first.preferred.
|
40
|
+
allow(@storage).to receive(:save_contact) do |contact|
|
41
|
+
expect(contact.email_addresses.first.preferred).to eq true
|
43
42
|
end
|
44
43
|
@service.update(@contact, "one@example.org", {:preferred => true})
|
45
44
|
end
|
46
45
|
|
47
46
|
it "should mark the address as not preferred if asked to" do
|
48
47
|
@contact.email_addresses.first.preferred = true
|
49
|
-
@storage.
|
50
|
-
contact.email_addresses.first.preferred.
|
48
|
+
allow(@storage).to receive(:save_contact) do |contact|
|
49
|
+
expect(contact.email_addresses.first.preferred).to eq false
|
51
50
|
end
|
52
51
|
@service.update(@contact, "one@example.org", {:preferred => false})
|
53
52
|
end
|
@@ -56,14 +55,14 @@ describe Ppl::Service::EmailAddress do
|
|
56
55
|
describe "#remove" do
|
57
56
|
|
58
57
|
it "should remove the email address from the contact" do
|
59
|
-
@storage.
|
60
|
-
contact.email_addresses.length.
|
58
|
+
allow(@storage).to receive(:save_contact) do |contact|
|
59
|
+
expect(contact.email_addresses.length).to eq 0
|
61
60
|
end
|
62
61
|
@service.remove(@contact, "one@example.org")
|
63
62
|
end
|
64
63
|
|
65
64
|
it "should store the contact" do
|
66
|
-
@storage.
|
65
|
+
expect(@storage).to receive(:save_contact).with(@contact)
|
67
66
|
@service.remove(@contact, "")
|
68
67
|
end
|
69
68
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Service::Name do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -9,15 +8,15 @@ describe Ppl::Service::Name do
|
|
9
8
|
describe "#parse" do
|
10
9
|
|
11
10
|
it "uses the whole string for the full name" do
|
12
|
-
@service.parse("John Smith").full.
|
11
|
+
expect(@service.parse("John Smith").full).to eq "John Smith"
|
13
12
|
end
|
14
13
|
|
15
14
|
it "uses the first word for the given name" do
|
16
|
-
@service.parse("John Smith").given.
|
15
|
+
expect(@service.parse("John Smith").given).to eq "John"
|
17
16
|
end
|
18
17
|
|
19
18
|
it "uses the rest of the string for the family names" do
|
20
|
-
@service.parse("John Fitzgerald Donald Smith").family.
|
19
|
+
expect(@service.parse("John Fitzgerald Donald Smith").family).to eq "Fitzgerald Donald Smith"
|
21
20
|
end
|
22
21
|
|
23
22
|
end
|
@@ -26,32 +25,32 @@ describe Ppl::Service::Name do
|
|
26
25
|
|
27
26
|
it "updates the full name" do
|
28
27
|
@service.update(@name, {:full => "Abc Def"})
|
29
|
-
@name.full.
|
28
|
+
expect(@name.full).to eq "Abc Def"
|
30
29
|
end
|
31
30
|
|
32
31
|
it "updates the given names" do
|
33
32
|
@service.update(@name, {:given => "John"})
|
34
|
-
@name.given.
|
33
|
+
expect(@name.given).to eq "John"
|
35
34
|
end
|
36
35
|
|
37
36
|
it "updates the family names" do
|
38
37
|
@service.update(@name, {:family => "Smith"})
|
39
|
-
@name.family.
|
38
|
+
expect(@name.family).to eq "Smith"
|
40
39
|
end
|
41
40
|
|
42
41
|
it "updates the middle names" do
|
43
42
|
@service.update(@name, {:middle => "Arnold"})
|
44
|
-
@name.middle.
|
43
|
+
expect(@name.middle).to eq "Arnold"
|
45
44
|
end
|
46
45
|
|
47
46
|
it "updates the name prefix" do
|
48
47
|
@service.update(@name, {:prefix => "Mr"})
|
49
|
-
@name.prefix.
|
48
|
+
expect(@name.prefix).to eq "Mr"
|
50
49
|
end
|
51
50
|
|
52
51
|
it "updates the name suffix" do
|
53
52
|
@service.update(@name, {:suffix => "BSc"})
|
54
|
-
@name.suffix.
|
53
|
+
expect(@name.suffix).to eq "BSc"
|
55
54
|
end
|
56
55
|
|
57
56
|
end
|
@@ -1,11 +1,10 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Service::PhoneNumber do
|
3
2
|
|
4
3
|
before(:each) do
|
5
4
|
@service = Ppl::Service::PhoneNumber.new
|
6
5
|
@contact = Ppl::Entity::Contact.new
|
7
6
|
@storage = double(Ppl::Adapter::Storage)
|
8
|
-
@storage.
|
7
|
+
allow(@storage).to receive(:save_contact)
|
9
8
|
@service.storage = @storage
|
10
9
|
@contact.phone_numbers << Ppl::Entity::PhoneNumber.new("01234567890")
|
11
10
|
end
|
@@ -14,16 +13,16 @@ describe Ppl::Service::PhoneNumber do
|
|
14
13
|
|
15
14
|
it "should add the phone number to the contact" do
|
16
15
|
@service.add(@contact, "10987654321", {})
|
17
|
-
@contact.phone_numbers[1].number.
|
16
|
+
expect(@contact.phone_numbers[1].number).to eq "10987654321"
|
18
17
|
end
|
19
18
|
|
20
19
|
it "should process the input options against the new contact" do
|
21
20
|
@service.add(@contact, "10987654321", {:preferred => true})
|
22
|
-
@contact.phone_numbers[1].preferred.
|
21
|
+
expect(@contact.phone_numbers[1].preferred).to eq true
|
23
22
|
end
|
24
23
|
|
25
24
|
it "should store the contact" do
|
26
|
-
@storage.
|
25
|
+
expect(@storage).to receive(:save_contact).with(@contact)
|
27
26
|
@service.add(@contact, "", {})
|
28
27
|
end
|
29
28
|
|
@@ -33,25 +32,25 @@ describe Ppl::Service::PhoneNumber do
|
|
33
32
|
|
34
33
|
it "should update the number's type" do
|
35
34
|
@service.update(@contact, "01234567890", {:type => "cell"})
|
36
|
-
@contact.phone_numbers.first.type.
|
35
|
+
expect(@contact.phone_numbers.first.type).to eq "cell"
|
37
36
|
end
|
38
37
|
|
39
38
|
it "should update the number's preferred status" do
|
40
39
|
@contact.phone_numbers << Ppl::Entity::PhoneNumber.new("109876543210")
|
41
40
|
@contact.phone_numbers[1].preferred = true
|
42
41
|
@service.update(@contact, "01234567890", {:preferred => true})
|
43
|
-
@contact.phone_numbers[0].preferred.
|
44
|
-
@contact.phone_numbers[1].preferred.
|
42
|
+
expect(@contact.phone_numbers[0].preferred).to eq true
|
43
|
+
expect(@contact.phone_numbers[1].preferred).to eq false
|
45
44
|
end
|
46
45
|
|
47
46
|
it "should mark numbers as not preferred" do
|
48
47
|
@contact.phone_numbers[0].preferred = true
|
49
48
|
@service.update(@contact, "01234567890", {:preferred => false})
|
50
|
-
@contact.phone_numbers[0].preferred.
|
49
|
+
expect(@contact.phone_numbers[0].preferred).to eq false
|
51
50
|
end
|
52
51
|
|
53
52
|
it "should store the contact" do
|
54
|
-
@storage.
|
53
|
+
expect(@storage).to receive(:save_contact).with(@contact)
|
55
54
|
@service.update(@contact, "", {})
|
56
55
|
end
|
57
56
|
|
@@ -61,11 +60,11 @@ describe Ppl::Service::PhoneNumber do
|
|
61
60
|
|
62
61
|
it "should remove the phone number from the contact" do
|
63
62
|
@service.remove(@contact, "01234567890")
|
64
|
-
@contact.phone_numbers.length.
|
63
|
+
expect(@contact.phone_numbers.length).to eq 0
|
65
64
|
end
|
66
65
|
|
67
66
|
it "should store the contact" do
|
68
|
-
@storage.
|
67
|
+
expect(@storage).to receive(:save_contact).with(@contact)
|
69
68
|
@service.remove(@contact, "")
|
70
69
|
end
|
71
70
|
|