imap-backup 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec-all +2 -0
  3. data/.rubocop.yml +10 -1
  4. data/.travis.yml +1 -0
  5. data/README.md +1 -1
  6. data/Rakefile +0 -1
  7. data/bin/imap-backup +3 -9
  8. data/imap-backup.gemspec +5 -5
  9. data/lib/email/mboxrd/message.rb +2 -2
  10. data/lib/imap/backup/account/connection.rb +11 -3
  11. data/lib/imap/backup/account/folder.rb +11 -6
  12. data/lib/imap/backup/configuration/account.rb +7 -7
  13. data/lib/imap/backup/configuration/asker.rb +2 -1
  14. data/lib/imap/backup/configuration/connection_tester.rb +1 -1
  15. data/lib/imap/backup/configuration/folder_chooser.rb +32 -5
  16. data/lib/imap/backup/configuration/list.rb +2 -0
  17. data/lib/imap/backup/configuration/setup.rb +2 -1
  18. data/lib/imap/backup/configuration/store.rb +3 -6
  19. data/lib/imap/backup/downloader.rb +8 -7
  20. data/lib/imap/backup/serializer/mbox.rb +2 -1
  21. data/lib/imap/backup/serializer/mbox_store.rb +14 -6
  22. data/lib/imap/backup/uploader.rb +1 -0
  23. data/lib/imap/backup/utils.rb +11 -9
  24. data/lib/imap/backup/version.rb +1 -1
  25. data/spec/features/backup_spec.rb +6 -5
  26. data/spec/features/support/backup_directory.rb +5 -5
  27. data/spec/features/support/email_server.rb +11 -8
  28. data/spec/features/support/shared/connection_context.rb +2 -2
  29. data/spec/support/fixtures.rb +1 -1
  30. data/spec/support/higline_test_helpers.rb +1 -1
  31. data/spec/unit/email/mboxrd/message_spec.rb +51 -42
  32. data/spec/unit/email/provider_spec.rb +0 -2
  33. data/spec/unit/imap/backup/account/connection_spec.rb +18 -11
  34. data/spec/unit/imap/backup/account/folder_spec.rb +26 -12
  35. data/spec/unit/imap/backup/configuration/account_spec.rb +22 -19
  36. data/spec/unit/imap/backup/configuration/asker_spec.rb +30 -31
  37. data/spec/unit/imap/backup/configuration/connection_tester_spec.rb +16 -13
  38. data/spec/unit/imap/backup/configuration/folder_chooser_spec.rb +45 -18
  39. data/spec/unit/imap/backup/configuration/list_spec.rb +8 -13
  40. data/spec/unit/imap/backup/configuration/setup_spec.rb +36 -30
  41. data/spec/unit/imap/backup/configuration/store_spec.rb +7 -4
  42. data/spec/unit/imap/backup/downloader_spec.rb +11 -7
  43. data/spec/unit/imap/backup/serializer/mbox_spec.rb +2 -5
  44. data/spec/unit/imap/backup/serializer/mbox_store_spec.rb +4 -4
  45. data/spec/unit/imap/backup/uploader_spec.rb +0 -2
  46. data/spec/unit/imap/backup/utils_spec.rb +1 -3
  47. metadata +6 -6
@@ -1,4 +1,6 @@
1
1
  describe Imap::Backup::Serializer::Mbox do
2
+ subject { described_class.new(base_path, imap_folder) }
3
+
2
4
  let(:base_path) { "/base/path" }
3
5
  let(:store) do
4
6
  instance_double(
@@ -20,11 +22,6 @@ describe Imap::Backup::Serializer::Mbox do
20
22
  allow(Imap::Backup::Utils).to receive(:mode) { permissions }
21
23
  allow(Imap::Backup::Utils).to receive(:check_permissions) { true }
22
24
  allow(File).to receive(:directory?) { dir_exists }
23
- end
24
-
25
- subject { described_class.new(base_path, imap_folder) }
26
-
27
- before do
28
25
  allow(FileUtils).to receive(:chmod)
29
26
  allow(Imap::Backup::Serializer::MboxStore).to receive(:new) { store }
30
27
  end
@@ -1,13 +1,15 @@
1
1
  describe Imap::Backup::Serializer::MboxStore do
2
+ subject { described_class.new(base_path, folder) }
3
+
2
4
  let(:base_path) { "/base/path" }
3
5
  let(:folder) { "the/folder" }
4
6
  let(:folder_path) { File.join(base_path, folder) }
5
7
  let(:imap_pathname) { folder_path + ".imap" }
6
8
  let(:imap_exists) { true }
7
- let(:imap_file) { double("File - imap", write: nil, close: nil) }
9
+ let(:imap_file) { instance_double(File, write: nil, close: nil) }
8
10
  let(:mbox_pathname) { folder_path + ".mbox" }
9
11
  let(:mbox_exists) { true }
10
- let(:mbox_file) { double("File - mbox", write: nil, close: nil) }
12
+ let(:mbox_file) { instance_double(File, write: nil, close: nil) }
11
13
  let(:uids) { [3, 2, 1] }
12
14
  let(:imap_content) do
13
15
  {
@@ -17,8 +19,6 @@ describe Imap::Backup::Serializer::MboxStore do
17
19
  }.to_json
18
20
  end
19
21
 
20
- subject { described_class.new(base_path, folder) }
21
-
22
22
  before do
23
23
  allow(File).to receive(:exist?).and_call_original
24
24
  allow(File).to receive(:exist?).with(imap_pathname) { imap_exists }
@@ -1,5 +1,3 @@
1
- require "spec_helper"
2
-
3
1
  describe Imap::Backup::Uploader do
4
2
  subject { described_class.new(folder, serializer) }
5
3
 
@@ -1,8 +1,6 @@
1
- require "spec_helper"
2
-
3
1
  describe Imap::Backup::Utils do
4
2
  let(:filename) { "foobar" }
5
- let(:stat) { double("File::Stat", mode: mode) }
3
+ let(:stat) { instance_double(File::Stat, mode: mode) }
6
4
  let(:mode) { 0o777 }
7
5
  let(:exists) { true }
8
6
 
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imap-backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Yates
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-10 00:00:00.000000000 Z
11
+ date: 2019-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake
14
+ name: highline
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: highline
28
+ name: mail
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: mail
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -208,7 +208,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
208
208
  requirements:
209
209
  - - ">="
210
210
  - !ruby/object:Gem::Version
211
- version: 2.2.0
211
+ version: 2.3.0
212
212
  required_rubygems_version: !ruby/object:Gem::Requirement
213
213
  requirements:
214
214
  - - ">="