ppl 4.0.1 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +1 -0
  3. data/features/step_definitions/ppl_steps.rb +3 -3
  4. data/ppl.gemspec +1 -1
  5. data/spec/ppl/adapter/color/colored_spec.rb +3 -3
  6. data/spec/ppl/adapter/email_scraper/mail_spec.rb +13 -13
  7. data/spec/ppl/adapter/output_spec.rb +7 -7
  8. data/spec/ppl/adapter/storage/disk_spec.rb +18 -18
  9. data/spec/ppl/adapter/storage/factory_spec.rb +3 -3
  10. data/spec/ppl/adapter/storage/git_spec.rb +31 -31
  11. data/spec/ppl/adapter/storage_spec.rb +3 -3
  12. data/spec/ppl/adapter/vcard/greencard_spec.rb +45 -45
  13. data/spec/ppl/application/bootstrap_spec.rb +128 -128
  14. data/spec/ppl/application/command_spec.rb +8 -8
  15. data/spec/ppl/application/command_suite_spec.rb +7 -7
  16. data/spec/ppl/application/configuration_spec.rb +16 -16
  17. data/spec/ppl/application/input_spec.rb +2 -2
  18. data/spec/ppl/application/router_spec.rb +8 -8
  19. data/spec/ppl/application/shell_spec.rb +39 -39
  20. data/spec/ppl/command/add_spec.rb +6 -6
  21. data/spec/ppl/command/age_spec.rb +7 -7
  22. data/spec/ppl/command/attribute_spec.rb +22 -22
  23. data/spec/ppl/command/bday_spec.rb +11 -11
  24. data/spec/ppl/command/completion_spec.rb +7 -7
  25. data/spec/ppl/command/email_spec.rb +19 -19
  26. data/spec/ppl/command/external_spec.rb +7 -7
  27. data/spec/ppl/command/help_spec.rb +15 -15
  28. data/spec/ppl/command/init_spec.rb +5 -5
  29. data/spec/ppl/command/ls_spec.rb +12 -12
  30. data/spec/ppl/command/mutt_spec.rb +33 -33
  31. data/spec/ppl/command/mv_spec.rb +11 -11
  32. data/spec/ppl/command/name_spec.rb +17 -17
  33. data/spec/ppl/command/nick_spec.rb +1 -1
  34. data/spec/ppl/command/org_spec.rb +1 -1
  35. data/spec/ppl/command/phone_spec.rb +15 -15
  36. data/spec/ppl/command/post_spec.rb +29 -29
  37. data/spec/ppl/command/rm_spec.rb +3 -3
  38. data/spec/ppl/command/scrape_spec.rb +24 -24
  39. data/spec/ppl/command/shell_spec.rb +41 -41
  40. data/spec/ppl/command/show_spec.rb +4 -4
  41. data/spec/ppl/command/url_spec.rb +1 -1
  42. data/spec/ppl/command/version_spec.rb +4 -4
  43. data/spec/ppl/entity/address_book_spec.rb +1 -1
  44. data/spec/ppl/entity/contact_spec.rb +16 -16
  45. data/spec/ppl/entity/email_address_spec.rb +3 -3
  46. data/spec/ppl/entity/name_spec.rb +1 -1
  47. data/spec/ppl/entity/phone_number_spec.rb +5 -5
  48. data/spec/ppl/entity/postal_address_spec.rb +2 -2
  49. data/spec/ppl/format/address_book/ages_spec.rb +3 -3
  50. data/spec/ppl/format/address_book/birthdays_spec.rb +3 -3
  51. data/spec/ppl/format/address_book/email_addresses_spec.rb +3 -3
  52. data/spec/ppl/format/address_book/mutt_query_spec.rb +3 -3
  53. data/spec/ppl/format/address_book/names_spec.rb +3 -3
  54. data/spec/ppl/format/address_book/nicknames_spec.rb +4 -4
  55. data/spec/ppl/format/address_book/one_line_spec.rb +5 -5
  56. data/spec/ppl/format/address_book/organizations_spec.rb +3 -3
  57. data/spec/ppl/format/address_book/phone_numbers_spec.rb +3 -3
  58. data/spec/ppl/format/address_book/postal_addresses_spec.rb +2 -2
  59. data/spec/ppl/format/address_book/urls_spec.rb +3 -3
  60. data/spec/ppl/format/contact/age_spec.rb +8 -8
  61. data/spec/ppl/format/contact/birthday_spec.rb +4 -4
  62. data/spec/ppl/format/contact/email_addresses_spec.rb +3 -3
  63. data/spec/ppl/format/contact/full_spec.rb +11 -11
  64. data/spec/ppl/format/contact/nicknames_spec.rb +4 -4
  65. data/spec/ppl/format/contact/organization_spec.rb +4 -4
  66. data/spec/ppl/format/contact/phone_number_spec.rb +4 -4
  67. data/spec/ppl/format/contact/postal_address_spec.rb +1 -1
  68. data/spec/ppl/format/contact/postal_addresses_spec.rb +3 -3
  69. data/spec/ppl/format/contact/urls_spec.rb +4 -4
  70. data/spec/ppl/format/custom/contact_spec.rb +13 -13
  71. data/spec/ppl/format/custom/email_address_spec.rb +3 -3
  72. data/spec/ppl/format/custom/phone_number_spec.rb +4 -4
  73. data/spec/ppl/format/custom_spec.rb +6 -6
  74. data/spec/ppl/format/name/full_only_spec.rb +4 -4
  75. data/spec/ppl/format/postal_address/multi_line_spec.rb +10 -10
  76. data/spec/ppl/format/postal_address/one_line_spec.rb +9 -9
  77. data/spec/ppl/format/table_spec.rb +11 -11
  78. data/spec/ppl/service/email_address_spec.rb +13 -13
  79. data/spec/ppl/service/name_spec.rb +9 -9
  80. data/spec/ppl/service/phone_number_spec.rb +11 -11
  81. data/spec/ppl/service/postal_address_spec.rb +20 -20
  82. data/spec/spec_helper.rb +3 -0
  83. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7e7227e67ddcd57d56016f63b0d40b51c2989d62f9f0d42b764535c1176a436
4
- data.tar.gz: 9444983ccb14e1ee6d73626fed21a5aaf7c6aba89013dff4d706b088bb57e654
3
+ metadata.gz: 4cc246db0a4e91b85f3f04c9c7961ff4e564c9ce91ba87631d4efdabe6c0aec0
4
+ data.tar.gz: cc829862f67814f88a44a8f50367b7a453d2deee549d2f73af9b4f7c47855b4f
5
5
  SHA512:
6
- metadata.gz: f3efe966f2e4d2d0f19b87392a2643e457b8cb71c49916000ca5ec0c2060f8238d41110b59203b1eb4dda48703f2c7bee52880e7486235647eb1e345d9b93d83
7
- data.tar.gz: a2b65af534bc75927673e93387ac35056b376337a31ad28e175ba5606b1717d5b31bea46cb2661b7539ff9d0aba1e8276a3b71d04ed75c7a3b8c111edf4bf472
6
+ metadata.gz: e32285452876a1a7312a4a683b18bbdca0ff2e45bea87034def7bd794a0044bbd8c5e6a8b2067da36a12a070345afeb46ff03b8e698ae8dda1003c3bc491f7a4
7
+ data.tar.gz: aab66b67e9def63ef307be8ea85619d7346f4a77897fbe1dd29bc3db847d1dbe496dfe69007e515da2c282a7f128f516c870d24d069710c6f703888262822cd8
@@ -29,4 +29,5 @@ jobs:
29
29
  if: ${{ github.ref == 'refs/heads/trunk' }}
30
30
  with:
31
31
  api_key: ${{secrets.RUBYGEMS_API_KEY}}
32
+ github_token: ${{secrets.GITHUB_TOKEN}}
32
33
 
@@ -11,11 +11,11 @@ When /^I run "ppl ([^"]+)"$/ do |command|
11
11
  end
12
12
 
13
13
  Then /^it should succeed$/ do
14
- $?.exitstatus.should eq 0
14
+ expect($?.exitstatus).to eq 0
15
15
  end
16
16
 
17
17
  Then /^it should fail$/ do
18
- $?.exitstatus.should_not eq 0
18
+ expect($?.exitstatus).not_to eq 0
19
19
  end
20
20
 
21
21
  Then /^there should be (\d+) contacts?$/ do |n|
@@ -28,7 +28,7 @@ end
28
28
 
29
29
  Then /^(bob) should have (\d+) email addresse?s?$/ do |name, number|
30
30
  @email_addresses = ppl("email #{name}").split("\n")
31
- @email_addresses.length.should eq number.to_i
31
+ expect(@email_addresses.length).to eq number.to_i
32
32
  end
33
33
 
34
34
  Then /^(bob) should have (\d+) nicknames?$/ do |name, number|
data/ppl.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |spec|
2
2
 
3
3
  spec.name = "ppl"
4
- spec.version = "4.0.1"
4
+ spec.version = "4.0.2"
5
5
  spec.date = "2021-04-02"
6
6
 
7
7
  spec.required_ruby_version = ">= 3.0.0"
@@ -8,13 +8,13 @@ describe Ppl::Adapter::Color::Colored do
8
8
 
9
9
  it "should colorize the string using the monkeypatched String method" do
10
10
  string = "example"
11
- string.should_receive(:red).and_return("red example")
12
- @adapter.colorize(string, "red").should eq "red example"
11
+ expect(string).to receive(:red).and_return("red example")
12
+ expect(@adapter.colorize(string, "red")).to eq "red example"
13
13
  end
14
14
 
15
15
  it "should only attempt to colorize the string if the color exists" do
16
16
  string = "example"
17
- @adapter.colorize(string, "neon").should eq "example"
17
+ expect(@adapter.colorize(string, "neon")).to eq "example"
18
18
  end
19
19
 
20
20
  end
@@ -11,7 +11,7 @@ describe Ppl::Adapter::EmailScraper::Mail do
11
11
  describe "#scrape_contacts" do
12
12
 
13
13
  it "should return an array" do
14
- @adapter.scrape_contacts("").should eq []
14
+ expect(@adapter.scrape_contacts("")).to eq []
15
15
  end
16
16
 
17
17
  it "should scrape the sender's name" do
@@ -26,9 +26,9 @@ describe Ppl::Adapter::EmailScraper::Mail do
26
26
  "This is a test email.",
27
27
  "Bye!",
28
28
  ].join("\n")
29
- @storage.should_receive(:load_contact).and_return(nil)
29
+ expect(@storage).to receive(:load_contact).and_return(nil)
30
30
  contacts = @adapter.scrape_contacts(email)
31
- contacts.first.name.full.should eq "Test User"
31
+ expect(contacts.first.name.full).to eq "Test User"
32
32
  end
33
33
 
34
34
  it "should scrape the sender's email address" do
@@ -43,9 +43,9 @@ describe Ppl::Adapter::EmailScraper::Mail do
43
43
  "This is a test email.",
44
44
  "Bye!",
45
45
  ].join("\n")
46
- @storage.should_receive(:load_contact).and_return(nil)
46
+ expect(@storage).to receive(:load_contact).and_return(nil)
47
47
  contacts = @adapter.scrape_contacts(email)
48
- contacts.first.email_addresses.first.address.should eq "test@example.org"
48
+ expect(contacts.first.email_addresses.first.address).to eq "test@example.org"
49
49
  end
50
50
 
51
51
  it "should generate an ID for the sender based on their name" do
@@ -60,9 +60,9 @@ describe Ppl::Adapter::EmailScraper::Mail do
60
60
  "This is a test email.",
61
61
  "Bye!",
62
62
  ].join("\n")
63
- @storage.should_receive(:load_contact).and_return(nil)
63
+ expect(@storage).to receive(:load_contact).and_return(nil)
64
64
  contacts = @adapter.scrape_contacts(email)
65
- contacts.first.id.should eq "test_user"
65
+ expect(contacts.first.id).to eq "test_user"
66
66
  end
67
67
 
68
68
  it "should generate a sender ID based on email address if there's no name" do
@@ -78,7 +78,7 @@ describe Ppl::Adapter::EmailScraper::Mail do
78
78
  "Bye!",
79
79
  ].join("\n")
80
80
  contacts = @adapter.scrape_contacts(email)
81
- contacts.first.id.should eq "test@example.org"
81
+ expect(contacts.first.id).to eq "test@example.org"
82
82
  end
83
83
 
84
84
  it "avoids overwriting an existing contact ID" do
@@ -93,10 +93,10 @@ describe Ppl::Adapter::EmailScraper::Mail do
93
93
  "This is a test email.",
94
94
  "Bye!",
95
95
  ].join("\n")
96
- @storage.should_receive(:load_contact).with("test_user").and_return(Ppl::Entity::Contact.new)
97
- @storage.should_receive(:load_contact).with("test_user_1").and_return(nil)
96
+ expect(@storage).to receive(:load_contact).with("test_user").and_return(Ppl::Entity::Contact.new)
97
+ expect(@storage).to receive(:load_contact).with("test_user_1").and_return(nil)
98
98
  contacts = @adapter.scrape_contacts(email)
99
- contacts.first.id.should eq "test_user_1"
99
+ expect(contacts.first.id).to eq "test_user_1"
100
100
  end
101
101
 
102
102
  it "allows non-ASCII sender names" do
@@ -112,10 +112,10 @@ describe Ppl::Adapter::EmailScraper::Mail do
112
112
  "Bye!",
113
113
  ].join("\n")
114
114
 
115
- @storage.should_receive(:load_contact).and_return(nil)
115
+ expect(@storage).to receive(:load_contact).and_return(nil)
116
116
  contacts = @adapter.scrape_contacts(email)
117
117
 
118
- contacts.first.name.full.should eq "Александр"
118
+ expect(contacts.first.name.full).to eq "Александр"
119
119
  end
120
120
 
121
121
  end
@@ -3,13 +3,13 @@ describe Ppl::Application::Output, "#initialize" do
3
3
  it "should accept stdout" do
4
4
  stdout = Object.new
5
5
  @output = Ppl::Application::Output.new(stdout, nil)
6
- @output.stdout.should be stdout
6
+ expect(@output.stdout).to be stdout
7
7
  end
8
8
 
9
9
  it "should accept stderr" do
10
10
  stderr = Object.new
11
11
  @output = Ppl::Application::Output.new(nil, stderr)
12
- @output.stderr.should be stderr
12
+ expect(@output.stderr).to be stderr
13
13
  end
14
14
 
15
15
  end
@@ -25,7 +25,7 @@ describe Ppl::Application::Output do
25
25
  describe "#error" do
26
26
  it "should delegate to stderr's puts method" do
27
27
  string = "COMPUTER OVER. VIRUS = VERY YES"
28
- @stderr.should_receive(:puts).with(string)
28
+ expect(@stderr).to receive(:puts).with(string)
29
29
  @output.error(string)
30
30
  end
31
31
  end
@@ -33,25 +33,25 @@ describe Ppl::Application::Output do
33
33
  describe "#line" do
34
34
  it "should delegate to stdout's puts method" do
35
35
  string = "The quick brown fox"
36
- @stdout.should_receive(:puts).with(string)
36
+ expect(@stdout).to receive(:puts).with(string)
37
37
  @output.line(string)
38
38
  end
39
39
 
40
40
  it "should not send carriage returns to stdout" do
41
41
  string = "The quick brown fox
42
- @stdout.should_receive(:puts).with("The quick brown fox")
42
+ expect(@stdout).to receive(:puts).with("The quick brown fox")
43
43
  @output.line(string)
44
44
  end
45
45
 
46
46
  it "should not send carriage returns to stderr" do
47
47
  string = "The quick brown fox
48
- @stderr.should_receive(:puts).with("The quick brown fox")
48
+ expect(@stderr).to receive(:puts).with("The quick brown fox")
49
49
  @output.error(string)
50
50
  end
51
51
 
52
52
  it "should not sanitise output if nil" do
53
53
  string = nil
54
- @stdout.should_receive(:puts).with(nil)
54
+ expect(@stdout).to receive(:puts).with(nil)
55
55
  @output.line(string)
56
56
  end
57
57
  end
@@ -11,13 +11,13 @@ describe Ppl::Adapter::Storage::Disk, "#create_address_book" do
11
11
  describe "#create_address_book" do
12
12
  it "should create the directory if it doesn't exist yet" do
13
13
  Ppl::Adapter::Storage::Disk.create_address_book("/contacts")
14
- Dir.exists?("/contacts").should eq true
14
+ expect(Dir.exists?("/contacts")).to eq true
15
15
  FileUtils.rm_rf("/contacts")
16
16
  end
17
17
  it "should return a Ppl::Adapter::Storage::Disk" do
18
18
  disk = Ppl::Adapter::Storage::Disk.create_address_book("/contacts")
19
19
  FileUtils.rm_rf("/contacts")
20
- disk.should be_a(Ppl::Adapter::Storage::Disk)
20
+ expect(disk).to be_a(Ppl::Adapter::Storage::Disk)
21
21
  end
22
22
  end
23
23
 
@@ -28,7 +28,7 @@ describe Ppl::Adapter::Storage::Disk, "#initialize" do
28
28
  it "should accept a Dir object" do
29
29
  directory = Dir.new("/tmp")
30
30
  @storage = Ppl::Adapter::Storage::Disk.new(directory)
31
- @storage.directory.should be directory
31
+ expect(@storage.directory).to be directory
32
32
  end
33
33
 
34
34
  end
@@ -43,7 +43,7 @@ describe Ppl::Adapter::Storage::Disk do
43
43
  it "should accept a vcard adapter" do
44
44
  adapter = double(Ppl::Adapter::Vcard)
45
45
  @storage.vcard_adapter = adapter
46
- @storage.vcard_adapter.should be adapter
46
+ expect(@storage.vcard_adapter).to be adapter
47
47
  end
48
48
  end
49
49
 
@@ -70,24 +70,24 @@ describe Ppl::Adapter::Storage::Disk do
70
70
 
71
71
  describe "#path" do
72
72
  it "should return the path of the directory" do
73
- @storage.path.should eq "/contacts"
73
+ expect(@storage.path).to eq "/contacts"
74
74
  end
75
75
  end
76
76
 
77
77
  describe "#load_address_book" do
78
78
 
79
79
  it "should return a Ppl::Entity::AddressBook" do
80
- @storage.load_address_book.should be_a(Ppl::Entity::AddressBook)
80
+ expect(@storage.load_address_book).to be_a(Ppl::Entity::AddressBook)
81
81
  end
82
82
 
83
83
  it "should fill the address book with the contacts in the directory" do
84
84
  FileUtils.touch "/contacts/one.vcf"
85
85
  FileUtils.touch "/contacts/two.vcf"
86
86
 
87
- @adapter.should_receive(:decode).twice
87
+ expect(@adapter).to receive(:decode).twice
88
88
 
89
89
  address_book = @storage.load_address_book
90
- address_book.contacts.count.should eq 2
90
+ expect(address_book.contacts.count).to eq 2
91
91
  end
92
92
 
93
93
  end
@@ -95,19 +95,19 @@ describe Ppl::Adapter::Storage::Disk do
95
95
  describe "#load_contact" do
96
96
 
97
97
  it "should return nil if the given contact doesn't exist" do
98
- @storage.load_contact("xyz").should be nil
98
+ expect(@storage.load_contact("xyz")).to be nil
99
99
  end
100
100
 
101
101
  it "should return a Ppl::Entity::Contact" do
102
102
  FileUtils.touch "/contacts/one.vcf"
103
- @adapter.should_receive(:decode).once.and_return(@contact)
104
- @storage.load_contact("one").should be_a(Ppl::Entity::Contact)
103
+ expect(@adapter).to receive(:decode).once.and_return(@contact)
104
+ expect(@storage.load_contact("one")).to be_a(Ppl::Entity::Contact)
105
105
  end
106
106
 
107
107
  it "should populate the contact's id" do
108
108
  FileUtils.touch "/contacts/one.vcf"
109
- @adapter.should_receive(:decode).once.and_return(@contact)
110
- @storage.load_contact("one").id.should eq "one"
109
+ expect(@adapter).to receive(:decode).once.and_return(@contact)
110
+ expect(@storage.load_contact("one").id).to eq "one"
111
111
  end
112
112
 
113
113
  end
@@ -115,12 +115,12 @@ describe Ppl::Adapter::Storage::Disk do
115
115
  describe "#save_contact" do
116
116
 
117
117
  it "should write the contact to disk" do
118
- @adapter.should_receive(:encode).with(@contact).and_return("asdfg")
118
+ expect(@adapter).to receive(:encode).with(@contact).and_return("asdfg")
119
119
 
120
120
  @contact.id = "test"
121
121
  @storage.save_contact(@contact)
122
122
 
123
- File.read("/contacts/test.vcf").should eq "asdfg"
123
+ expect(File.read("/contacts/test.vcf")).to eq "asdfg"
124
124
  end
125
125
 
126
126
  end
@@ -130,20 +130,20 @@ describe Ppl::Adapter::Storage::Disk do
130
130
  FileUtils.touch "/contacts/test.vcf"
131
131
  @contact.id = "test"
132
132
  @storage.delete_contact(@contact)
133
- File.exists?("/contacts/test.vcf").should eq false
133
+ expect(File.exists?("/contacts/test.vcf")).to eq false
134
134
  end
135
135
  end
136
136
 
137
137
  describe "#filename_for_contact" do
138
138
  it "should base the filename on the contact's id" do
139
139
  @contact.id = "test"
140
- @storage.filename_for_contact(@contact).should eq "/contacts/test.vcf"
140
+ expect(@storage.filename_for_contact(@contact)).to eq "/contacts/test.vcf"
141
141
  end
142
142
  end
143
143
 
144
144
  describe "#filename_for_contact_id" do
145
145
  it "should base the filename on the directory path" do
146
- @storage.filename_for_contact_id("test").should eq "/contacts/test.vcf"
146
+ expect(@storage.filename_for_contact_id("test")).to eq "/contacts/test.vcf"
147
147
  end
148
148
  end
149
149
 
@@ -8,7 +8,7 @@ describe Ppl::Adapter::Storage::Factory do
8
8
  @directory = Dir.new("/contacts")
9
9
  @repo = double(Rugged::Repository)
10
10
 
11
- Rugged::Repository.stub(:new).and_return(@repo)
11
+ allow(Rugged::Repository).to receive(:new).and_return(@repo)
12
12
  end
13
13
 
14
14
  after(:each) do
@@ -19,12 +19,12 @@ describe Ppl::Adapter::Storage::Factory do
19
19
  describe "#load_adapter" do
20
20
 
21
21
  it "should return a disk adapter by default" do
22
- @factory.load_adapter(@directory).should be_a(Ppl::Adapter::Storage::Disk)
22
+ expect(@factory.load_adapter(@directory)).to be_a(Ppl::Adapter::Storage::Disk)
23
23
  end
24
24
 
25
25
  it "should return a git adapter if the directory is a git repository" do
26
26
  Dir.mkdir "/contacts/.git"
27
- @factory.load_adapter(@directory).should be_a(Ppl::Adapter::Storage::Git)
27
+ expect(@factory.load_adapter(@directory)).to be_a(Ppl::Adapter::Storage::Git)
28
28
  end
29
29
 
30
30
  end
@@ -13,11 +13,11 @@ describe Ppl::Adapter::Storage::Git do
13
13
  @vcard = double(Ppl::Adapter::Vcard)
14
14
  @target = double(Rugged::Commit)
15
15
 
16
- Rugged::Repository.stub(:new).and_return(@repo)
16
+ allow(Rugged::Repository).to receive(:new).and_return(@repo)
17
17
 
18
- @disk.stub(:directory).and_return(Dir.new("/contacts"))
19
- @disk.stub(:path).and_return("/contacts")
20
- @contact.stub(:id).and_return("test")
18
+ allow(@disk).to receive(:directory).and_return(Dir.new("/contacts"))
19
+ allow(@disk).to receive(:path).and_return("/contacts")
20
+ allow(@contact).to receive(:id).and_return("test")
21
21
 
22
22
  @git = Ppl::Adapter::Storage::Git.new(@disk)
23
23
  @git.vcard_adapter = @vcard
@@ -30,16 +30,16 @@ describe Ppl::Adapter::Storage::Git do
30
30
 
31
31
  describe "#path" do
32
32
  it "should return the path of the repository" do
33
- @git.path.should eq "/contacts"
33
+ expect(@git.path).to eq "/contacts"
34
34
  end
35
35
  end
36
36
 
37
37
  describe "#initialize" do
38
38
  it "should accept a disk storage adapter" do
39
- @git.disk.should be @disk
39
+ expect(@git.disk).to be @disk
40
40
  end
41
41
  it "should instantiate rugged" do
42
- @git.repository.should be @repo
42
+ expect(@git.repository).to be @repo
43
43
  end
44
44
  end
45
45
 
@@ -50,12 +50,12 @@ describe Ppl::Adapter::Storage::Git do
50
50
 
51
51
  @files = [{:name => "test.vcf"}]
52
52
 
53
- @commit.should_receive(:target).and_return(@target)
54
- @target.should_receive(:oid)
55
- @repo.should_receive(:lookup).and_return(@head)
56
- @repo.should_receive(:head).and_return(@commit)
53
+ expect(@commit).to receive(:target).and_return(@target)
54
+ expect(@target).to receive(:oid)
55
+ expect(@repo).to receive(:lookup).and_return(@head)
56
+ expect(@repo).to receive(:head).and_return(@commit)
57
57
 
58
- @git.stub(:load_contact) do |id|
58
+ allow(@git).to receive(:load_contact) do |id|
59
59
  contact = Ppl::Entity::Contact.new
60
60
  contact.id = id
61
61
  contact
@@ -64,17 +64,17 @@ describe Ppl::Adapter::Storage::Git do
64
64
  end
65
65
 
66
66
  it "should return an address book" do
67
- @head.should_receive(:tree).and_return(@files)
68
- @git.load_address_book.should be_a(Ppl::Entity::AddressBook)
67
+ expect(@head).to receive(:tree).and_return(@files)
68
+ expect(@git.load_address_book).to be_a(Ppl::Entity::AddressBook)
69
69
  end
70
70
 
71
71
  it "should not put anything except contacts in the address book" do
72
72
  @files = [{:name => "poop.vcf"}, {:name => ".ppl"}]
73
- @head.should_receive(:tree).and_return(@files)
73
+ expect(@head).to receive(:tree).and_return(@files)
74
74
 
75
75
  address_book = @git.load_address_book
76
76
  address_book.contacts.each do |contact|
77
- contact.should be_a(Ppl::Entity::Contact)
77
+ expect(contact).to be_a(Ppl::Entity::Contact)
78
78
  end
79
79
  end
80
80
 
@@ -91,10 +91,10 @@ describe Ppl::Adapter::Storage::Git do
91
91
  blob = OpenStruct.new
92
92
  blob.content = 'vcard contents'
93
93
 
94
- @repo.should_receive(:head).and_return(head)
95
- @repo.should_receive(:blob_at).and_return(blob)
96
- @vcard.should_receive(:decode).and_return(@contact)
97
- @contact.should_receive(:id=).with("test")
94
+ expect(@repo).to receive(:head).and_return(head)
95
+ expect(@repo).to receive(:blob_at).and_return(blob)
96
+ expect(@vcard).to receive(:decode).and_return(@contact)
97
+ expect(@contact).to receive(:id=).with("test")
98
98
 
99
99
  contact = @git.load_contact("test")
100
100
  end
@@ -108,9 +108,9 @@ describe Ppl::Adapter::Storage::Git do
108
108
  blob = OpenStruct.new
109
109
  blob.content = 'vcard contents'
110
110
 
111
- @repo.should_receive(:head).and_return(head)
112
- @repo.should_receive(:blob_at).and_return(blob)
113
- @vcard.should_receive(:decode).and_raise(Vpim::InvalidEncodingError)
111
+ expect(@repo).to receive(:head).and_return(head)
112
+ expect(@repo).to receive(:blob_at).and_return(blob)
113
+ expect(@vcard).to receive(:decode).and_raise(Vpim::InvalidEncodingError)
114
114
  expect{ @git.load_contact("test") }.to raise_error(Ppl::Error::InvalidVcard)
115
115
  end
116
116
 
@@ -119,19 +119,19 @@ describe Ppl::Adapter::Storage::Git do
119
119
  describe "#save_contact" do
120
120
 
121
121
  it "should save the contact to disk" do
122
- @disk.should_receive(:save_contact).with(@contact)
123
- @git.stub(:add)
124
- @git.stub(:commit)
122
+ expect(@disk).to receive(:save_contact).with(@contact)
123
+ allow(@git).to receive(:add)
124
+ allow(@git).to receive(:commit)
125
125
  @git.save_contact(@contact)
126
126
  end
127
127
 
128
128
  it "should commit the changes" do
129
- @disk.should_receive(:save_contact)
130
- @git.stub(:add) do |file|
131
- file.should eq "test.vcf"
129
+ expect(@disk).to receive(:save_contact)
130
+ allow(@git).to receive(:add) do |file|
131
+ expect(file).to eq "test.vcf"
132
132
  end
133
- @git.stub(:commit) do |message|
134
- message.should eq "save_contact(test)"
133
+ allow(@git).to receive(:commit) do |message|
134
+ expect(message).to eq "save_contact(test)"
135
135
  end
136
136
  @git.save_contact(@contact)
137
137
  end