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::Contact::Birthday do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -11,18 +10,18 @@ describe Ppl::Format::Contact::Birthday do
|
|
11
10
|
describe "#process" do
|
12
11
|
|
13
12
|
it "should return an empty string if the contact lacks a birthday" do
|
14
|
-
@format.process(Ppl::Entity::Contact.new).
|
13
|
+
expect(@format.process(Ppl::Entity::Contact.new)).to eq ""
|
15
14
|
end
|
16
15
|
|
17
16
|
it "should return the contact's birthday if it is set" do
|
18
17
|
@contact.birthday = Date.parse("1970-01-01")
|
19
|
-
@format.process(@contact).
|
18
|
+
expect(@format.process(@contact)).to eq "1970-01-01"
|
20
19
|
end
|
21
20
|
|
22
21
|
it "should colorize the string if configured to do so" do
|
23
22
|
@format.colors = { "birthday" => "blue" }
|
24
|
-
@color.
|
25
|
-
@format.process(@contact).
|
23
|
+
expect(@color).to receive(:colorize).and_return("birthday in blue")
|
24
|
+
expect(@format.process(@contact)).to eq "birthday in blue"
|
26
25
|
end
|
27
26
|
|
28
27
|
end
|
@@ -1,9 +1,8 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Format::Contact::EmailAddresses do
|
3
2
|
describe "#initialize" do
|
4
3
|
it "should pass the colors through to the table" do
|
5
4
|
colors = {"id" => "blue"}
|
6
|
-
Ppl::Format::Table.
|
5
|
+
expect(Ppl::Format::Table).to receive(:new).with([:star, :email_addresses], colors)
|
7
6
|
format = Ppl::Format::Contact::EmailAddresses.new(colors)
|
8
7
|
end
|
9
8
|
end
|
@@ -23,7 +22,7 @@ describe Ppl::Format::Contact::EmailAddresses do
|
|
23
22
|
describe "#process" do
|
24
23
|
|
25
24
|
it "should pass each email address to the table" do
|
26
|
-
@table.
|
25
|
+
expect(@table).to receive(:add_row).with({
|
27
26
|
:star => " ",
|
28
27
|
:email_addresses => "test@example.org",
|
29
28
|
})
|
@@ -32,7 +31,7 @@ describe Ppl::Format::Contact::EmailAddresses do
|
|
32
31
|
|
33
32
|
it "should mark the preferred email with a star" do
|
34
33
|
@email.preferred = true
|
35
|
-
@table.
|
34
|
+
expect(@table).to receive(:add_row).with({
|
36
35
|
:star => "*",
|
37
36
|
:email_addresses => "test@example.org",
|
38
37
|
})
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Format::Contact::Full do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -13,26 +12,26 @@ describe Ppl::Format::Contact::Full do
|
|
13
12
|
@format.phone_number_format = @phone_number_format
|
14
13
|
@format.postal_address_format = @postal_address_format
|
15
14
|
|
16
|
-
@email_address_format.
|
15
|
+
allow(@email_address_format).to receive(:process)
|
17
16
|
end
|
18
17
|
|
19
18
|
describe "#process" do
|
20
19
|
|
21
20
|
it "should return an empty string if the contact lacks any properties" do
|
22
|
-
@format.process(Ppl::Entity::Contact.new).
|
21
|
+
expect(@format.process(Ppl::Entity::Contact.new)).to eq ""
|
23
22
|
end
|
24
23
|
|
25
24
|
it "should start with the contact's name" do
|
26
25
|
@contact.name = Ppl::Entity::Name.new
|
27
26
|
@contact.name.full = "John Doe"
|
28
|
-
@format.process(@contact).
|
27
|
+
expect(@format.process(@contact)).to eq "John Doe"
|
29
28
|
end
|
30
29
|
|
31
30
|
it "should include their email address in brackets" do
|
32
31
|
@contact.name = Ppl::Entity::Name.new
|
33
32
|
@contact.name.full = "John Doe"
|
34
33
|
@contact.email_addresses << Ppl::Entity::EmailAddress.new("john@example.org")
|
35
|
-
@format.process(@contact).
|
34
|
+
expect(@format.process(@contact)).to include "John Doe <john@example.org>"
|
36
35
|
end
|
37
36
|
|
38
37
|
it "should include their preferred email address in brackets" do
|
@@ -41,40 +40,40 @@ describe Ppl::Format::Contact::Full do
|
|
41
40
|
@contact.email_addresses << Ppl::Entity::EmailAddress.new("john@example.org")
|
42
41
|
@contact.email_addresses << Ppl::Entity::EmailAddress.new("fred@testtest.es")
|
43
42
|
@contact.email_addresses[1].preferred = true
|
44
|
-
@format.process(@contact).
|
43
|
+
expect(@format.process(@contact)).to include "John Doe <fred@testtest.es>"
|
45
44
|
end
|
46
45
|
|
47
46
|
it "should invoke the email address formatter if there are any addresses" do
|
48
47
|
@contact.email_addresses << Ppl::Entity::EmailAddress.new("john@example.net")
|
49
|
-
@email_address_format.
|
48
|
+
expect(@email_address_format).to receive(:process).with(@contact)
|
50
49
|
@format.process(@contact)
|
51
50
|
end
|
52
51
|
|
53
52
|
it "should invoke the phone number formatter if there are any numbers" do
|
54
53
|
@contact.phone_numbers << Ppl::Entity::PhoneNumber.new("01234567890")
|
55
|
-
@phone_number_format.
|
54
|
+
expect(@phone_number_format).to receive(:process).with(@contact)
|
56
55
|
@format.process(@contact)
|
57
56
|
end
|
58
57
|
|
59
58
|
it "should show their birthday if available" do
|
60
59
|
@contact.birthday = Date.parse("1980-01-01")
|
61
|
-
@format.process(@contact).
|
60
|
+
expect(@format.process(@contact)).to include "1980-01-01"
|
62
61
|
end
|
63
62
|
|
64
63
|
it "should show all their organizations" do
|
65
64
|
@contact.organizations.push("Example Ltd")
|
66
|
-
@format.process(@contact).
|
65
|
+
expect(@format.process(@contact)).to include "Example Ltd"
|
67
66
|
end
|
68
67
|
|
69
68
|
it "should show their postal address if available" do
|
70
69
|
@contact.postal_addresses << @address
|
71
|
-
@postal_address_format.
|
70
|
+
expect(@postal_address_format).to receive(:process).and_return("")
|
72
71
|
@format.process(@contact)
|
73
72
|
end
|
74
73
|
|
75
74
|
it "should show all their URLs" do
|
76
75
|
@contact.urls.push "http://example.org"
|
77
|
-
@format.process(@contact).
|
76
|
+
expect(@format.process(@contact)).to include "http://example.org"
|
78
77
|
end
|
79
78
|
|
80
79
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Format::Contact::Nicknames do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -11,18 +10,18 @@ describe Ppl::Format::Contact::Nicknames do
|
|
11
10
|
describe "#process" do
|
12
11
|
|
13
12
|
it "should return an empty string if the contact lacks a nickname" do
|
14
|
-
@format.process(Ppl::Entity::Contact.new).
|
13
|
+
expect(@format.process(Ppl::Entity::Contact.new)).to eq ""
|
15
14
|
end
|
16
15
|
|
17
16
|
it "should return the contact's nickname if one is set" do
|
18
17
|
@contact.nicknames.push("Dopey")
|
19
|
-
@format.process(@contact).
|
18
|
+
expect(@format.process(@contact)).to eq "Dopey"
|
20
19
|
end
|
21
20
|
|
22
21
|
it "should colorize the string if configured to do so" do
|
23
22
|
@format.colors = { "nicknames" => "blue" }
|
24
|
-
@color.
|
25
|
-
@format.process(@contact).
|
23
|
+
expect(@color).to receive(:colorize).and_return("nicknames in blue")
|
24
|
+
expect(@format.process(@contact)).to eq "nicknames in blue"
|
26
25
|
end
|
27
26
|
|
28
27
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Format::Contact::Organization do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -11,18 +10,18 @@ describe Ppl::Format::Contact::Organization do
|
|
11
10
|
describe "#process" do
|
12
11
|
|
13
12
|
it "should return an empty string if the contact lacks an organization" do
|
14
|
-
@format.process(Ppl::Entity::Contact.new).
|
13
|
+
expect(@format.process(Ppl::Entity::Contact.new)).to eq ""
|
15
14
|
end
|
16
15
|
|
17
16
|
it "should return the contact's organization if it is set" do
|
18
17
|
@contact.organizations.push("Example Ltd")
|
19
|
-
@format.process(@contact).
|
18
|
+
expect(@format.process(@contact)).to eq "Example Ltd"
|
20
19
|
end
|
21
20
|
|
22
21
|
it "should colorize the string if configured to do so" do
|
23
22
|
@format.colors = { "organizations" => "blue" }
|
24
|
-
@color.
|
25
|
-
@format.process(@contact).
|
23
|
+
expect(@color).to receive(:colorize).and_return("organizations in blue")
|
24
|
+
expect(@format.process(@contact)).to eq "organizations in blue"
|
26
25
|
end
|
27
26
|
|
28
27
|
end
|
@@ -1,10 +1,9 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Format::Contact::PhoneNumber do
|
3
2
|
|
4
3
|
describe "#initialize" do
|
5
4
|
it "should pass the colors through to the table" do
|
6
5
|
colors = {"number" => "blue"}
|
7
|
-
Ppl::Format::Table.
|
6
|
+
expect(Ppl::Format::Table).to receive(:new).with([:star, :phone_numbers, :type], colors)
|
8
7
|
format = Ppl::Format::Contact::PhoneNumber.new(colors)
|
9
8
|
end
|
10
9
|
end
|
@@ -21,7 +20,7 @@ describe Ppl::Format::Contact::PhoneNumber do
|
|
21
20
|
end
|
22
21
|
|
23
22
|
it "should always include the phone number" do
|
24
|
-
@table.
|
23
|
+
expect(@table).to receive(:add_row).with({
|
25
24
|
:star => " ",
|
26
25
|
:phone_numbers => "01234567890",
|
27
26
|
:type => nil,
|
@@ -31,7 +30,7 @@ describe Ppl::Format::Contact::PhoneNumber do
|
|
31
30
|
|
32
31
|
it "should put the type in parentheses" do
|
33
32
|
@number.type = "work"
|
34
|
-
@table.
|
33
|
+
expect(@table).to receive(:add_row).with({
|
35
34
|
:star => " ",
|
36
35
|
:phone_numbers => "01234567890",
|
37
36
|
:type => "(work)",
|
@@ -41,7 +40,7 @@ describe Ppl::Format::Contact::PhoneNumber do
|
|
41
40
|
|
42
41
|
it "should mark preferred numbers with a star" do
|
43
42
|
@number.preferred = true
|
44
|
-
@table.
|
43
|
+
expect(@table).to receive(:add_row).with({
|
45
44
|
:star => "*",
|
46
45
|
:phone_numbers => "01234567890",
|
47
46
|
:type => nil,
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Format::Contact::PostalAddress do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -14,7 +13,7 @@ describe Ppl::Format::Contact::PostalAddress do
|
|
14
13
|
|
15
14
|
it "should return the contact's street address if it is set" do
|
16
15
|
@address.street = "1 Test Road"
|
17
|
-
@table.
|
16
|
+
expect(@table).to receive(:add_row).with({
|
18
17
|
:label => "Street:",
|
19
18
|
:value => "1 Test Road",
|
20
19
|
})
|
@@ -1,9 +1,8 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Format::Contact::PostalAddresses do
|
3
2
|
describe "#initialize" do
|
4
3
|
it "should pass the colors through to the table" do
|
5
4
|
colors = {"address_id" => "blue"}
|
6
|
-
Ppl::Format::Table.
|
5
|
+
expect(Ppl::Format::Table).to receive(:new).with([:star, :address_id, :address_text], colors)
|
7
6
|
format = Ppl::Format::Contact::PostalAddresses.new(colors)
|
8
7
|
end
|
9
8
|
end
|
@@ -25,8 +24,8 @@ describe Ppl::Format::Contact::PostalAddresses do
|
|
25
24
|
|
26
25
|
it "passes each postal address to the postal address formatter" do
|
27
26
|
@contact.postal_addresses << @address
|
28
|
-
@pa_fmt.
|
29
|
-
@table.
|
27
|
+
expect(@pa_fmt).to receive(:process).with(@address, @table)
|
28
|
+
expect(@table).to receive(:to_s)
|
30
29
|
@format.process(@contact)
|
31
30
|
end
|
32
31
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Format::Contact::Urls do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -11,18 +10,18 @@ describe Ppl::Format::Contact::Urls do
|
|
11
10
|
describe "#process" do
|
12
11
|
|
13
12
|
it "should return an empty string if the contact lacks a URL" do
|
14
|
-
@format.process(Ppl::Entity::Contact.new).
|
13
|
+
expect(@format.process(Ppl::Entity::Contact.new)).to eq ""
|
15
14
|
end
|
16
15
|
|
17
16
|
it "should return the contact's URL if one is set" do
|
18
17
|
@contact.urls.push "http://example.org/~jdoe"
|
19
|
-
@format.process(@contact).
|
18
|
+
expect(@format.process(@contact)).to eq "http://example.org/~jdoe"
|
20
19
|
end
|
21
20
|
|
22
21
|
it "should colorize the string if configured to do so" do
|
23
22
|
@format.colors = { "urls" => "blue" }
|
24
|
-
@color.
|
25
|
-
@format.process(@contact).
|
23
|
+
expect(@color).to receive(:colorize).and_return("urls in blue")
|
24
|
+
expect(@format.process(@contact)).to eq "urls in blue"
|
26
25
|
end
|
27
26
|
|
28
27
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Format::Custom::Contact do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -9,7 +8,7 @@ describe Ppl::Format::Custom::Contact do
|
|
9
8
|
describe "%n" do
|
10
9
|
it "should be replaced with a newlines" do
|
11
10
|
@format.format = "%n"
|
12
|
-
@format.process(@contact).
|
11
|
+
expect(@format.process(@contact)).to eq "\n"
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
@@ -17,7 +16,7 @@ describe Ppl::Format::Custom::Contact do
|
|
17
16
|
it "should output the contact's ID" do
|
18
17
|
@contact.id = "test"
|
19
18
|
@format.format = "%i"
|
20
|
-
@format.process(@contact).
|
19
|
+
expect(@format.process(@contact)).to eq "test"
|
21
20
|
end
|
22
21
|
end
|
23
22
|
|
@@ -25,7 +24,7 @@ describe Ppl::Format::Custom::Contact do
|
|
25
24
|
it "should output the contact's name" do
|
26
25
|
@contact.name = "John Doe"
|
27
26
|
@format.format = "%N"
|
28
|
-
@format.process(@contact).
|
27
|
+
expect(@format.process(@contact)).to eq "John Doe"
|
29
28
|
end
|
30
29
|
end
|
31
30
|
|
@@ -33,16 +32,16 @@ describe Ppl::Format::Custom::Contact do
|
|
33
32
|
it "should output the contact's nickname" do
|
34
33
|
@contact.nicknames << "Johnny"
|
35
34
|
@format.format = "%k"
|
36
|
-
@format.process(@contact).
|
35
|
+
expect(@format.process(@contact)).to eq "Johnny"
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
40
39
|
describe "%a" do
|
41
40
|
it "should output the contact's age" do
|
42
41
|
@contact.birthday = Date.parse("2000-01-01")
|
43
|
-
Date.
|
42
|
+
allow(Date).to receive(:today).and_return(Date.parse("2010-01-02"))
|
44
43
|
@format.format = "%a"
|
45
|
-
@format.process(@contact).
|
44
|
+
expect(@format.process(@contact)).to eq "10"
|
46
45
|
end
|
47
46
|
end
|
48
47
|
|
@@ -50,12 +49,12 @@ describe Ppl::Format::Custom::Contact do
|
|
50
49
|
it "should output the contact's birthday" do
|
51
50
|
@contact.birthday = Date.parse("1985-06-07")
|
52
51
|
@format.format = "%b"
|
53
|
-
@format.process(@contact).
|
52
|
+
expect(@format.process(@contact)).to eq "1985-06-07"
|
54
53
|
end
|
55
54
|
it "should cause no errors if there's no birthday" do
|
56
55
|
@contact.birthday = nil
|
57
56
|
@format.format = "%b"
|
58
|
-
@format.process(@contact).
|
57
|
+
expect(@format.process(@contact)).to eq ""
|
59
58
|
end
|
60
59
|
end
|
61
60
|
|
@@ -66,11 +65,11 @@ describe Ppl::Format::Custom::Contact do
|
|
66
65
|
@contact.email_addresses << Ppl::Entity::EmailAddress.new("b@example.org")
|
67
66
|
end
|
68
67
|
it "should output the first email address" do
|
69
|
-
@format.process(@contact).
|
68
|
+
expect(@format.process(@contact)).to eq "a@example.org"
|
70
69
|
end
|
71
70
|
it "should output the preferred email address" do
|
72
71
|
@contact.email_addresses[1].preferred = true
|
73
|
-
@format.process(@contact).
|
72
|
+
expect(@format.process(@contact)).to eq "b@example.org"
|
74
73
|
end
|
75
74
|
end
|
76
75
|
|
@@ -81,11 +80,11 @@ describe Ppl::Format::Custom::Contact do
|
|
81
80
|
@contact.phone_numbers << Ppl::Entity::PhoneNumber.new("1098765432")
|
82
81
|
end
|
83
82
|
it "should output the first phone number" do
|
84
|
-
@format.process(@contact).
|
83
|
+
expect(@format.process(@contact)).to eq "0123456789"
|
85
84
|
end
|
86
85
|
it "should output the preferred phone number" do
|
87
86
|
@contact.phone_numbers[1].preferred = true
|
88
|
-
@format.process(@contact).
|
87
|
+
expect(@format.process(@contact)).to eq "1098765432"
|
89
88
|
end
|
90
89
|
end
|
91
90
|
|
@@ -93,7 +92,7 @@ describe Ppl::Format::Custom::Contact do
|
|
93
92
|
it "should output the contact's organization" do
|
94
93
|
@contact.organizations << "WTF Inc"
|
95
94
|
@format.format = "%o"
|
96
|
-
@format.process(@contact).
|
95
|
+
expect(@format.process(@contact)).to eq "WTF Inc"
|
97
96
|
end
|
98
97
|
end
|
99
98
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Format::Custom::EmailAddress do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -10,7 +9,7 @@ describe Ppl::Format::Custom::EmailAddress do
|
|
10
9
|
it "should output the address" do
|
11
10
|
@address.address = "test@example.org"
|
12
11
|
@format.format = "<%a>"
|
13
|
-
@format.process(@address).
|
12
|
+
expect(@format.process(@address)).to eq "<test@example.org>"
|
14
13
|
end
|
15
14
|
end
|
16
15
|
|
@@ -20,11 +19,11 @@ describe Ppl::Format::Custom::EmailAddress do
|
|
20
19
|
end
|
21
20
|
it "should output a star if the address is preferred" do
|
22
21
|
@address.preferred = true
|
23
|
-
@format.process(@address).
|
22
|
+
expect(@format.process(@address)).to eq "*"
|
24
23
|
end
|
25
24
|
it "should output nothing if the address is not preferred" do
|
26
25
|
@address.preferred = false
|
27
|
-
@format.process(@address).
|
26
|
+
expect(@format.process(@address)).to eq ""
|
28
27
|
end
|
29
28
|
end
|
30
29
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Format::Custom::PhoneNumber do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -10,7 +9,7 @@ describe Ppl::Format::Custom::PhoneNumber do
|
|
10
9
|
it "should output the number itself" do
|
11
10
|
@number.number = "1234567890"
|
12
11
|
@format.format = "tel: %n"
|
13
|
-
@format.process(@number).
|
12
|
+
expect(@format.process(@number)).to eq "tel: 1234567890"
|
14
13
|
end
|
15
14
|
end
|
16
15
|
|
@@ -18,7 +17,7 @@ describe Ppl::Format::Custom::PhoneNumber do
|
|
18
17
|
it "should output the type of the number" do
|
19
18
|
@number.type = "cell"
|
20
19
|
@format.format = "(%t)"
|
21
|
-
@format.process(@number).
|
20
|
+
expect(@format.process(@number)).to eq "(cell)"
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
@@ -28,11 +27,11 @@ describe Ppl::Format::Custom::PhoneNumber do
|
|
28
27
|
end
|
29
28
|
it "should output a star if the number is preferred" do
|
30
29
|
@number.preferred = true
|
31
|
-
@format.process(@number).
|
30
|
+
expect(@format.process(@number)).to eq "*"
|
32
31
|
end
|
33
32
|
it "should output nothing if the number is not preferred" do
|
34
33
|
@number.preferred = false
|
35
|
-
@format.process(@number).
|
34
|
+
expect(@format.process(@number)).to eq ""
|
36
35
|
end
|
37
36
|
end
|
38
37
|
|