ppl 3.0.0 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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::Command::Mutt do
|
|
3
2
|
|
|
4
3
|
before(:each) do
|
|
@@ -18,7 +17,7 @@ describe Ppl::Command::Mutt do
|
|
|
18
17
|
|
|
19
18
|
describe "#name" do
|
|
20
19
|
it "should be 'mutt'" do
|
|
21
|
-
@command.name.
|
|
20
|
+
expect(@command.name).to eq "mutt"
|
|
22
21
|
end
|
|
23
22
|
end
|
|
24
23
|
|
|
@@ -30,9 +29,9 @@ describe Ppl::Command::Mutt do
|
|
|
30
29
|
|
|
31
30
|
it "should search the address book for the query" do
|
|
32
31
|
@input.arguments.push "query"
|
|
33
|
-
@command.
|
|
34
|
-
@output.
|
|
35
|
-
@command.execute(@input, @output).
|
|
32
|
+
expect(@command).to receive(:mutt_search).and_return(Ppl::Entity::AddressBook.new)
|
|
33
|
+
expect(@output).to receive(:line).with("No matches")
|
|
34
|
+
expect(@command.execute(@input, @output)).to eq false
|
|
36
35
|
end
|
|
37
36
|
|
|
38
37
|
it "should return email address matches" do
|
|
@@ -43,13 +42,13 @@ describe Ppl::Command::Mutt do
|
|
|
43
42
|
|
|
44
43
|
@input.arguments.push "example"
|
|
45
44
|
|
|
46
|
-
@storage.
|
|
47
|
-
@format.
|
|
48
|
-
@output.
|
|
49
|
-
line.
|
|
50
|
-
line.
|
|
45
|
+
expect(@storage).to receive(:load_address_book).and_return(@address_book)
|
|
46
|
+
expect(@format).to receive(:process).and_return("test@example.org\tTest User")
|
|
47
|
+
expect(@output).to receive(:line) do |line|
|
|
48
|
+
expect(line).to include "Searching address book... 1 email addresses... 1 matching:"
|
|
49
|
+
expect(line).to include "test@example.org\tTest User"
|
|
51
50
|
end
|
|
52
|
-
@command.execute(@input, @output).
|
|
51
|
+
expect(@command.execute(@input, @output)).to eq true
|
|
53
52
|
end
|
|
54
53
|
|
|
55
54
|
it "should only return matching email addresses" do
|
|
@@ -59,12 +58,12 @@ describe Ppl::Command::Mutt do
|
|
|
59
58
|
@contact.email_addresses << Ppl::Entity::EmailAddress.new("test@test.org")
|
|
60
59
|
@contact.email_addresses << Ppl::Entity::EmailAddress.new("prova@prova.org")
|
|
61
60
|
@address_book.contacts.push(@contact)
|
|
62
|
-
@storage.
|
|
63
|
-
@format.
|
|
64
|
-
address_book.contacts[0].email_addresses.length.
|
|
65
|
-
address_book.contacts[0].email_addresses[0].address.
|
|
61
|
+
allow(@storage).to receive(:load_address_book).and_return(@address_book)
|
|
62
|
+
expect(@format).to receive(:process) do |address_book|
|
|
63
|
+
expect(address_book.contacts[0].email_addresses.length).to eq 1
|
|
64
|
+
expect(address_book.contacts[0].email_addresses[0].address).to eq "prova@prova.org"
|
|
66
65
|
end
|
|
67
|
-
@output.
|
|
66
|
+
allow(@output).to receive(:line)
|
|
68
67
|
@command.execute(@input, @output)
|
|
69
68
|
end
|
|
70
69
|
|
|
@@ -76,13 +75,13 @@ describe Ppl::Command::Mutt do
|
|
|
76
75
|
|
|
77
76
|
@input.arguments.push "User"
|
|
78
77
|
|
|
79
|
-
@storage.
|
|
80
|
-
@format.
|
|
81
|
-
@output.
|
|
82
|
-
line.
|
|
83
|
-
line.
|
|
78
|
+
expect(@storage).to receive(:load_address_book).and_return(@address_book)
|
|
79
|
+
expect(@format).to receive(:process).and_return("test@example.org\tTest User")
|
|
80
|
+
expect(@output).to receive(:line) do |line|
|
|
81
|
+
expect(line).to include "Searching address book... 1 email addresses... 1 matching:"
|
|
82
|
+
expect(line).to include "test@example.org\tTest User"
|
|
84
83
|
end
|
|
85
|
-
@command.execute(@input, @output).
|
|
84
|
+
expect(@command.execute(@input, @output)).to eq true
|
|
86
85
|
end
|
|
87
86
|
|
|
88
87
|
|
|
@@ -94,11 +93,11 @@ describe Ppl::Command::Mutt do
|
|
|
94
93
|
@contact.email_addresses << Ppl::Entity::EmailAddress.new("prova@prova.org")
|
|
95
94
|
@address_book.contacts << @contact
|
|
96
95
|
|
|
97
|
-
@storage.
|
|
98
|
-
@format.
|
|
99
|
-
@output.
|
|
100
|
-
@output.
|
|
101
|
-
line.
|
|
96
|
+
allow(@storage).to receive(:load_address_book).and_return(@address_book)
|
|
97
|
+
allow(@format).to receive(:process)
|
|
98
|
+
allow(@output).to receive(:line)
|
|
99
|
+
expect(@output).to receive(:line) do |line|
|
|
100
|
+
expect(line).to include "Searching address book... 2 email addresses... 2 matching:"
|
|
102
101
|
end
|
|
103
102
|
@command.execute(@input, @output)
|
|
104
103
|
end
|
|
@@ -113,23 +112,23 @@ describe Ppl::Command::Mutt do
|
|
|
113
112
|
@contact.email_addresses << Ppl::Entity::EmailAddress.new("joe@somewhere.com")
|
|
114
113
|
@contact.email_addresses << Ppl::Entity::EmailAddress.new("LOUD@SHOUTING.COM")
|
|
115
114
|
@address_book.contacts << @contact
|
|
116
|
-
@storage.
|
|
117
|
-
@output.
|
|
115
|
+
allow(@storage).to receive(:load_address_book).and_return(@address_book)
|
|
116
|
+
allow(@output).to receive(:line)
|
|
118
117
|
end
|
|
119
118
|
|
|
120
119
|
it "should ignore case when matching names" do
|
|
121
120
|
@input.arguments.push "joe schmoe"
|
|
122
|
-
@format.
|
|
123
|
-
address_book.contacts[0].email_addresses.length.
|
|
121
|
+
expect(@format).to receive(:process) do |address_book|
|
|
122
|
+
expect(address_book.contacts[0].email_addresses.length).to eq 2
|
|
124
123
|
end
|
|
125
124
|
@command.execute(@input, @output)
|
|
126
125
|
end
|
|
127
126
|
|
|
128
127
|
it "should ignore case when matching email addresses" do
|
|
129
128
|
@input.arguments.push "loud"
|
|
130
|
-
@format.
|
|
131
|
-
address_book.contacts[0].email_addresses.length.
|
|
132
|
-
address_book.contacts[0].email_addresses[0].address.
|
|
129
|
+
expect(@format).to receive(:process) do |address_book|
|
|
130
|
+
expect(address_book.contacts[0].email_addresses.length).to eq 1
|
|
131
|
+
expect(address_book.contacts[0].email_addresses[0].address).to eq "LOUD@SHOUTING.COM"
|
|
133
132
|
end
|
|
134
133
|
@command.execute(@input, @output)
|
|
135
134
|
end
|
data/spec/ppl/command/mv_spec.rb
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
describe Ppl::Command::Mv do
|
|
3
2
|
|
|
4
3
|
before(:each) do
|
|
@@ -14,7 +13,7 @@ describe Ppl::Command::Mv do
|
|
|
14
13
|
|
|
15
14
|
describe "#name" do
|
|
16
15
|
it "should be 'mv'" do
|
|
17
|
-
@command.name.
|
|
16
|
+
expect(@command.name).to eq "mv"
|
|
18
17
|
end
|
|
19
18
|
end
|
|
20
19
|
|
|
@@ -31,24 +30,24 @@ describe Ppl::Command::Mv do
|
|
|
31
30
|
end
|
|
32
31
|
|
|
33
32
|
it "should return false if the new id is taken" do
|
|
34
|
-
@storage.
|
|
35
|
-
@storage.
|
|
36
|
-
@output.
|
|
33
|
+
expect(@storage).to receive(:require_contact).with("old").and_return(@contact)
|
|
34
|
+
expect(@storage).to receive(:load_contact).with("new").and_return(@contact)
|
|
35
|
+
expect(@output).to receive(:error)
|
|
37
36
|
@input.arguments = ["old", "new"]
|
|
38
37
|
|
|
39
|
-
@command.execute(@input, @output).
|
|
38
|
+
expect(@command.execute(@input, @output)).to eq false
|
|
40
39
|
end
|
|
41
40
|
|
|
42
41
|
it "should rename the given contact" do
|
|
43
|
-
@storage.
|
|
44
|
-
@storage.
|
|
42
|
+
expect(@storage).to receive(:require_contact).with("old").and_return(@contact)
|
|
43
|
+
expect(@storage).to receive(:load_contact).with("new").and_return(nil)
|
|
45
44
|
|
|
46
|
-
@storage.
|
|
47
|
-
contact.id.
|
|
45
|
+
expect(@storage).to receive(:delete_contact).with(@contact) do |contact|
|
|
46
|
+
expect(contact.id).to eq "old"
|
|
48
47
|
end
|
|
49
48
|
|
|
50
|
-
@storage.
|
|
51
|
-
contact.id.
|
|
49
|
+
expect(@storage).to receive(:save_contact).with(@contact) do |contact|
|
|
50
|
+
expect(contact.id).to eq "new"
|
|
52
51
|
end
|
|
53
52
|
|
|
54
53
|
@input.arguments = ["old", "new"]
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
describe Ppl::Command::Name do
|
|
3
2
|
|
|
4
3
|
before(:each) do
|
|
@@ -25,51 +24,51 @@ describe Ppl::Command::Name do
|
|
|
25
24
|
|
|
26
25
|
describe "#name" do
|
|
27
26
|
it "should be 'name'" do
|
|
28
|
-
@command.name.
|
|
27
|
+
expect(@command.name).to eq "name"
|
|
29
28
|
end
|
|
30
29
|
end
|
|
31
30
|
|
|
32
31
|
describe "#execute" do
|
|
33
32
|
|
|
34
33
|
it "should list all contact names if no contact ID is given" do
|
|
35
|
-
@storage.
|
|
36
|
-
@list_format.
|
|
37
|
-
@output.
|
|
34
|
+
expect(@storage).to receive(:load_address_book).and_return(@address_book)
|
|
35
|
+
expect(@list_format).to receive(:process).and_return("all the names")
|
|
36
|
+
expect(@output).to receive(:line).with("all the names")
|
|
38
37
|
@input.arguments = []
|
|
39
38
|
@command.execute(@input, @output)
|
|
40
39
|
end
|
|
41
40
|
|
|
42
41
|
it "should show the specified contact's name if no name is given" do
|
|
43
|
-
@storage.
|
|
44
|
-
@show_format.
|
|
45
|
-
@output.
|
|
42
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
|
43
|
+
expect(@show_format).to receive(:process).and_return("John Doe")
|
|
44
|
+
expect(@output).to receive(:line).with("John Doe")
|
|
46
45
|
@input.arguments = ["jim"]
|
|
47
|
-
@command.execute(@input, @output).
|
|
46
|
+
expect(@command.execute(@input, @output)).to eq true
|
|
48
47
|
end
|
|
49
48
|
|
|
50
49
|
it "should not output anything if there's nothing to show" do
|
|
51
|
-
@storage.
|
|
52
|
-
@show_format.
|
|
50
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
|
51
|
+
expect(@show_format).to receive(:process).and_return("")
|
|
53
52
|
@input.arguments = ["jim"]
|
|
54
|
-
@command.execute(@input, @output).
|
|
53
|
+
expect(@command.execute(@input, @output)).to eq false
|
|
55
54
|
end
|
|
56
55
|
|
|
57
56
|
it "should change the contact's name if a name is given" do
|
|
58
|
-
@storage.
|
|
59
|
-
@name_service.
|
|
57
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
|
58
|
+
expect(@name_service).to receive(:update).with(@contact.name, {
|
|
60
59
|
:full => "Jim Jamieson"
|
|
61
60
|
})
|
|
62
|
-
@storage.
|
|
61
|
+
expect(@storage).to receive(:save_contact)
|
|
63
62
|
@input.arguments = ["jim", "Jim Jamieson"]
|
|
64
63
|
@command.execute(@input, @output)
|
|
65
64
|
end
|
|
66
65
|
|
|
67
66
|
it "should change the contact's name if a name is given" do
|
|
68
|
-
@storage.
|
|
69
|
-
@name_service.
|
|
67
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
|
68
|
+
expect(@name_service).to receive(:update).with(@contact.name, {
|
|
70
69
|
:family => "Smith"
|
|
71
70
|
})
|
|
72
|
-
@storage.
|
|
71
|
+
expect(@storage).to receive(:save_contact)
|
|
73
72
|
@input.arguments = ["jim"]
|
|
74
73
|
@input.options = { :family => "Smith" }
|
|
75
74
|
@command.execute(@input, @output)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
describe Ppl::Command::Phone do
|
|
3
2
|
|
|
4
3
|
before(:each) do
|
|
@@ -7,7 +6,7 @@ describe Ppl::Command::Phone do
|
|
|
7
6
|
|
|
8
7
|
describe "#name" do
|
|
9
8
|
it "should be 'phone'" do
|
|
10
|
-
@command.name.
|
|
9
|
+
expect(@command.name).to eq "phone"
|
|
11
10
|
end
|
|
12
11
|
end
|
|
13
12
|
|
|
@@ -21,8 +20,8 @@ describe Ppl::Command::Phone do
|
|
|
21
20
|
@show_format = double(Ppl::Format::Contact)
|
|
22
21
|
@input = Ppl::Application::Input.new
|
|
23
22
|
@output = double(Ppl::Application::Output)
|
|
24
|
-
@storage.
|
|
25
|
-
@storage.
|
|
23
|
+
allow(@storage).to receive(:require_contact).and_return(@contact)
|
|
24
|
+
allow(@storage).to receive(:save_contact)
|
|
26
25
|
@command.phone_service = @service
|
|
27
26
|
@command.storage = @storage
|
|
28
27
|
@command.list_format = @list_format
|
|
@@ -30,40 +29,40 @@ describe Ppl::Command::Phone do
|
|
|
30
29
|
end
|
|
31
30
|
|
|
32
31
|
it "should list all phone numbers by default" do
|
|
33
|
-
@storage.
|
|
34
|
-
@list_format.
|
|
35
|
-
@output.
|
|
32
|
+
expect(@storage).to receive(:load_address_book).and_return(@address_book)
|
|
33
|
+
expect(@list_format).to receive(:process)
|
|
34
|
+
expect(@output).to receive(:line)
|
|
36
35
|
@command.execute(@input, @output)
|
|
37
36
|
end
|
|
38
37
|
|
|
39
38
|
it "should show a single contact's numbers if one is specified" do
|
|
40
39
|
@input.arguments << "jdoe"
|
|
41
|
-
@storage.
|
|
42
|
-
@show_format.
|
|
43
|
-
@output.
|
|
40
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
|
41
|
+
expect(@show_format).to receive(:process)
|
|
42
|
+
expect(@output).to receive(:line)
|
|
44
43
|
@command.execute(@input, @output)
|
|
45
44
|
end
|
|
46
45
|
|
|
47
46
|
it "should delegate to the service layer to remove a phone number" do
|
|
48
47
|
@input.arguments = ["jdoe", "01234567890"]
|
|
49
48
|
@input.options[:delete] = true
|
|
50
|
-
@storage.
|
|
51
|
-
@service.
|
|
49
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
|
50
|
+
expect(@service).to receive(:remove).with(@contact, "01234567890")
|
|
52
51
|
@command.execute(@input, @output)
|
|
53
52
|
end
|
|
54
53
|
|
|
55
54
|
it "should delegate to the service layer to add a new phone number" do
|
|
56
55
|
@input.arguments = ["jdoe", "98776332"]
|
|
57
|
-
@storage.
|
|
58
|
-
@service.
|
|
56
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
|
57
|
+
expect(@service).to receive(:add).with(@contact, "98776332", @input.options)
|
|
59
58
|
@command.execute(@input, @output)
|
|
60
59
|
end
|
|
61
60
|
|
|
62
61
|
it "should delegate to the service layer to update an existing number" do
|
|
63
62
|
@contact.phone_numbers << Ppl::Entity::PhoneNumber.new("012345678")
|
|
64
63
|
@input.arguments = ["jdoe", "012345678"]
|
|
65
|
-
@storage.
|
|
66
|
-
@service.
|
|
64
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
|
65
|
+
expect(@service).to receive(:update).with(@contact, "012345678", {})
|
|
67
66
|
@command.execute(@input, @output)
|
|
68
67
|
end
|
|
69
68
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
describe Ppl::Command::Post do
|
|
3
2
|
|
|
4
3
|
before(:each) do
|
|
@@ -27,7 +26,7 @@ describe Ppl::Command::Post do
|
|
|
27
26
|
|
|
28
27
|
describe "#name" do
|
|
29
28
|
it "should be 'post'" do
|
|
30
|
-
@command.name.
|
|
29
|
+
expect(@command.name).to eq "post"
|
|
31
30
|
end
|
|
32
31
|
end
|
|
33
32
|
|
|
@@ -38,9 +37,9 @@ describe Ppl::Command::Post do
|
|
|
38
37
|
before { @input.arguments = [] }
|
|
39
38
|
|
|
40
39
|
it "displays postal address information for the whole address book" do
|
|
41
|
-
@storage.
|
|
42
|
-
@address_book_format.
|
|
43
|
-
@output.
|
|
40
|
+
expect(@storage).to receive(:load_address_book).and_return(@address_book)
|
|
41
|
+
expect(@address_book_format).to receive(:process).and_return("all the postal addresses")
|
|
42
|
+
expect(@output).to receive(:line).with("all the postal addresses")
|
|
44
43
|
@input.arguments = []
|
|
45
44
|
@command.execute(@input, @output)
|
|
46
45
|
end
|
|
@@ -51,16 +50,16 @@ describe Ppl::Command::Post do
|
|
|
51
50
|
before { @input.arguments = ["jim"] }
|
|
52
51
|
|
|
53
52
|
it "shows all of a contact's postal addresses" do
|
|
54
|
-
@storage.
|
|
55
|
-
@contact_format.
|
|
56
|
-
@output.
|
|
57
|
-
@command.execute(@input, @output).
|
|
53
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
|
54
|
+
expect(@contact_format).to receive(:process).and_return("1 Test Road")
|
|
55
|
+
expect(@output).to receive(:line).with("1 Test Road")
|
|
56
|
+
expect(@command.execute(@input, @output)).to eq true
|
|
58
57
|
end
|
|
59
58
|
|
|
60
59
|
it "outputs nothing if the contact has no addresses" do
|
|
61
|
-
@storage.
|
|
62
|
-
@contact_format.
|
|
63
|
-
@command.execute(@input, @output).
|
|
60
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
|
61
|
+
expect(@contact_format).to receive(:process).and_return("")
|
|
62
|
+
expect(@command.execute(@input, @output)).to eq false
|
|
64
63
|
end
|
|
65
64
|
|
|
66
65
|
end
|
|
@@ -70,16 +69,16 @@ describe Ppl::Command::Post do
|
|
|
70
69
|
before { @input.arguments = ["jim", "home"] }
|
|
71
70
|
|
|
72
71
|
it "shows a single postal address" do
|
|
73
|
-
@storage.
|
|
74
|
-
@postal_address_format.
|
|
75
|
-
@output.
|
|
76
|
-
@command.execute(@input, @output).
|
|
72
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
|
73
|
+
expect(@postal_address_format).to receive(:process).with(@address).and_return("1 Test Road")
|
|
74
|
+
expect(@output).to receive(:line).with("1 Test Road")
|
|
75
|
+
expect(@command.execute(@input, @output)).to eq true
|
|
77
76
|
end
|
|
78
77
|
|
|
79
78
|
it "raises an error if there's no such address" do
|
|
80
79
|
@input.arguments[1] = "other"
|
|
81
|
-
@storage.
|
|
82
|
-
expect{@command.execute(@input, @output).
|
|
80
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
|
81
|
+
expect{expect(@command.execute(@input, @output)).to eq true}.to raise_error(Ppl::Error::PostalAddressNotFound)
|
|
83
82
|
end
|
|
84
83
|
|
|
85
84
|
end
|
|
@@ -90,10 +89,10 @@ describe Ppl::Command::Post do
|
|
|
90
89
|
before { @input.options = { :delete => true }}
|
|
91
90
|
|
|
92
91
|
it "deletes the postal address" do
|
|
93
|
-
@storage.
|
|
94
|
-
@service.
|
|
95
|
-
@storage.
|
|
96
|
-
@command.execute(@input, @output).
|
|
92
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
|
93
|
+
expect(@service).to receive(:remove).with(@contact, "home")
|
|
94
|
+
expect(@storage).to receive(:save_contact)
|
|
95
|
+
expect(@command.execute(@input, @output)).to eq true
|
|
97
96
|
end
|
|
98
97
|
|
|
99
98
|
end
|
|
@@ -104,10 +103,10 @@ describe Ppl::Command::Post do
|
|
|
104
103
|
before { @input.options = { :country => "New Country" }}
|
|
105
104
|
|
|
106
105
|
it "updates the postal address" do
|
|
107
|
-
@storage.
|
|
108
|
-
@service.
|
|
109
|
-
@storage.
|
|
110
|
-
@command.execute(@input, @output).
|
|
106
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
|
107
|
+
expect(@service).to receive(:update).with(@contact, "home", {:country => "New Country"})
|
|
108
|
+
expect(@storage).to receive(:save_contact)
|
|
109
|
+
expect(@command.execute(@input, @output)).to eq true
|
|
111
110
|
end
|
|
112
111
|
|
|
113
112
|
end
|
|
@@ -119,10 +118,10 @@ describe Ppl::Command::Post do
|
|
|
119
118
|
before { @input.options = { :street => "123 Swim St" }}
|
|
120
119
|
|
|
121
120
|
it "adds the postal address" do
|
|
122
|
-
@storage.
|
|
123
|
-
@service.
|
|
124
|
-
@storage.
|
|
125
|
-
@command.execute(@input, @output).
|
|
121
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
|
122
|
+
expect(@service).to receive(:add).with(@contact, "newaddress", {:street => "123 Swim St"})
|
|
123
|
+
expect(@storage).to receive(:save_contact)
|
|
124
|
+
expect(@command.execute(@input, @output)).to eq true
|
|
126
125
|
end
|
|
127
126
|
|
|
128
127
|
end
|