imap-backup 4.0.7 → 4.1.1

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/bin/imap-backup +5 -2
  3. data/lib/imap/backup/account/connection.rb +53 -33
  4. data/lib/imap/backup/account/folder.rb +22 -2
  5. data/lib/imap/backup/account.rb +4 -0
  6. data/lib/imap/backup/cli/accounts.rb +43 -0
  7. data/lib/imap/backup/cli/folders.rb +3 -1
  8. data/lib/imap/backup/cli/helpers.rb +8 -9
  9. data/lib/imap/backup/cli/local.rb +4 -2
  10. data/lib/imap/backup/cli/setup.rb +1 -1
  11. data/lib/imap/backup/cli/utils.rb +3 -2
  12. data/lib/imap/backup/{configuration/store.rb → configuration.rb} +16 -3
  13. data/lib/imap/backup/downloader.rb +26 -12
  14. data/lib/imap/backup/logger.rb +42 -0
  15. data/lib/imap/backup/sanitizer.rb +42 -0
  16. data/lib/imap/backup/serializer/mbox_store.rb +2 -2
  17. data/lib/imap/backup/{configuration → setup}/account.rb +29 -19
  18. data/lib/imap/backup/{configuration → setup}/asker.rb +5 -5
  19. data/lib/imap/backup/setup/connection_tester.rb +26 -0
  20. data/lib/imap/backup/{configuration → setup}/folder_chooser.rb +18 -8
  21. data/lib/imap/backup/setup/helpers.rb +15 -0
  22. data/lib/imap/backup/{configuration/setup.rb → setup.rb} +23 -17
  23. data/lib/imap/backup/uploader.rb +2 -2
  24. data/lib/imap/backup/version.rb +2 -2
  25. data/lib/imap/backup.rb +7 -33
  26. data/lib/retry_on_error.rb +1 -1
  27. data/spec/features/backup_spec.rb +1 -0
  28. data/spec/features/support/email_server.rb +5 -2
  29. data/spec/support/higline_test_helpers.rb +1 -1
  30. data/spec/support/silence_logging.rb +1 -1
  31. data/spec/unit/imap/backup/account/connection_spec.rb +14 -9
  32. data/spec/unit/imap/backup/cli/accounts_spec.rb +47 -0
  33. data/spec/unit/imap/backup/cli/local_spec.rb +7 -3
  34. data/spec/unit/imap/backup/cli/utils_spec.rb +15 -5
  35. data/spec/unit/imap/backup/{configuration/store_spec.rb → configuration_spec.rb} +2 -2
  36. data/spec/unit/imap/backup/downloader_spec.rb +1 -1
  37. data/spec/unit/imap/backup/logger_spec.rb +48 -0
  38. data/spec/unit/imap/backup/{configuration → setup}/account_spec.rb +31 -24
  39. data/spec/unit/imap/backup/{configuration → setup}/asker_spec.rb +2 -2
  40. data/spec/unit/imap/backup/{configuration → setup}/connection_tester_spec.rb +10 -10
  41. data/spec/unit/imap/backup/{configuration → setup}/folder_chooser_spec.rb +8 -8
  42. data/spec/unit/imap/backup/{configuration/setup_spec.rb → setup_spec.rb} +48 -40
  43. metadata +49 -46
  44. data/lib/imap/backup/configuration/connection_tester.rb +0 -14
  45. data/lib/imap/backup/configuration/list.rb +0 -53
  46. data/spec/unit/imap/backup/configuration/list_spec.rb +0 -96
  47. data/spec/unit/imap/backup_spec.rb +0 -28
@@ -3,7 +3,7 @@ require "os"
3
3
 
4
4
  # rubocop:disable RSpec/PredicateMatcher
5
5
 
6
- describe Imap::Backup::Configuration::Store do
6
+ describe Imap::Backup::Configuration do
7
7
  let(:directory) { "/base/path" }
8
8
  let(:file_path) { File.join(directory, "/config.json") }
9
9
  let(:file_exists) { true }
@@ -17,7 +17,7 @@ describe Imap::Backup::Configuration::Store do
17
17
 
18
18
  before do
19
19
  stub_const(
20
- "Imap::Backup::Configuration::Store::CONFIGURATION_DIRECTORY", directory
20
+ "Imap::Backup::Configuration::CONFIGURATION_DIRECTORY", directory
21
21
  )
22
22
  allow(File).to receive(:directory?).with(directory) { directory_exists }
23
23
  allow(File).to receive(:exist?).and_call_original
@@ -6,7 +6,7 @@ describe Imap::Backup::Downloader do
6
6
  let(:folder) do
7
7
  instance_double(
8
8
  Imap::Backup::Account::Folder,
9
- fetch: body,
9
+ fetch_multi: [{uid: "111", body: body}],
10
10
  name: "folder",
11
11
  uids: folder_uids
12
12
  )
@@ -0,0 +1,48 @@
1
+ require "net/imap"
2
+
3
+ module Imap::Backup
4
+ describe Logger do
5
+ describe ".setup_logging" do
6
+ let(:config) { instance_double(Configuration, debug?: debug) }
7
+
8
+ around do |example|
9
+ logger_previous = described_class.logger.level
10
+ net_imap_previous = Net::IMAP.debug
11
+ described_class.logger.level = 42
12
+ Net::IMAP.debug = 42
13
+ example.run
14
+ Net::IMAP.debug = net_imap_previous
15
+ described_class.logger.level = logger_previous
16
+ end
17
+
18
+ before do
19
+ allow(Configuration).to receive(:new) { config }
20
+ described_class.setup_logging
21
+ end
22
+
23
+ context "when config.debug?" do
24
+ let(:debug) { true }
25
+
26
+ it "sets logger level to debug" do
27
+ expect(described_class.logger.level).to eq(::Logger::Severity::DEBUG)
28
+ end
29
+
30
+ it "sets the Net::IMAP debug flag" do
31
+ expect(Net::IMAP.debug).to be_a(TrueClass)
32
+ end
33
+ end
34
+
35
+ context "when not config.debug?" do
36
+ let(:debug) { false }
37
+
38
+ it "sets logger level to error" do
39
+ expect(described_class.logger.level).to eq(::Logger::Severity::ERROR)
40
+ end
41
+
42
+ it "sets the Net::IMAP debug flag" do
43
+ expect(Net::IMAP.debug).to be_a(FalseClass)
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -1,10 +1,10 @@
1
- describe Imap::Backup::Configuration::Account do
1
+ describe Imap::Backup::Setup::Account do
2
2
  ACCOUNT = "account".freeze
3
3
  GMAIL_IMAP_SERVER = "imap.gmail.com".freeze
4
4
  HIGHLINE = "highline".freeze
5
- STORE = "store".freeze
5
+ CONFIG = "config".freeze
6
6
 
7
- subject { described_class.new(store, account, highline) }
7
+ subject { described_class.new(config, account, highline) }
8
8
 
9
9
  let(:account) do
10
10
  instance_double(
@@ -14,7 +14,8 @@ describe Imap::Backup::Configuration::Account do
14
14
  server: current_server,
15
15
  connection_options: nil,
16
16
  local_path: "/backup/path",
17
- folders: [{name: "my_folder"}]
17
+ folders: [{name: "my_folder"}],
18
+ modified?: false
18
19
  )
19
20
  end
20
21
  let(:account1) do
@@ -33,10 +34,10 @@ describe Imap::Backup::Configuration::Account do
33
34
  let(:other_existing_path) { "/other/existing/path" }
34
35
 
35
36
  let(:highline) { HIGHLINE }
36
- let(:store) { STORE }
37
+ let(:config) { CONFIG }
37
38
 
38
39
  describe "#initialize" do
39
- [:store, :account, :highline].each do |param|
40
+ [:config, :account, :highline].each do |param|
40
41
  it "expects #{param}" do
41
42
  expect(subject.send(param)).to eq(send(param))
42
43
  end
@@ -65,8 +66,8 @@ describe Imap::Backup::Configuration::Account do
65
66
 
66
67
  let(:highline) { instance_double(HighLine) }
67
68
  let(:menu) { highline_menu_class.new }
68
- let(:store) do
69
- instance_double(Imap::Backup::Configuration::Store, accounts: accounts)
69
+ let(:config) do
70
+ instance_double(Imap::Backup::Configuration, accounts: accounts)
70
71
  end
71
72
 
72
73
  before do
@@ -103,7 +104,7 @@ describe Imap::Backup::Configuration::Account do
103
104
  "choose backup folders",
104
105
  "test connection",
105
106
  "delete",
106
- "return to main menu",
107
+ "(q) return to main menu",
107
108
  "quit" # TODO: quit is hidden
108
109
  ].each do |item|
109
110
  before { subject.run }
@@ -116,11 +117,11 @@ describe Imap::Backup::Configuration::Account do
116
117
 
117
118
  describe "account details" do
118
119
  [
119
- ["email", /email:\s+user@example.com/],
120
- ["server", /server:\s+imap.example.com/],
121
- ["password", /password:\s+x+/],
122
- ["path", %r(path:\s+/backup/path)],
123
- ["folders", /folders:\s+my_folder/]
120
+ ["email", /email\s+user@example.com/],
121
+ ["password", /password\s+x+/],
122
+ ["path", %r(path\s+/backup/path)],
123
+ ["folders", /folders\s+my_folder/],
124
+ ["server", /server\s+imap.example.com/]
124
125
  ].each do |attribute, value|
125
126
  before { subject.run }
126
127
 
@@ -135,7 +136,7 @@ describe Imap::Backup::Configuration::Account do
135
136
  before { subject.run }
136
137
 
137
138
  it "indicates that a password is not set" do
138
- expect(menu.header).to include("password: (unset)")
139
+ expect(menu.header).to include("password (unset)")
139
140
  end
140
141
  end
141
142
  end
@@ -144,7 +145,7 @@ describe Imap::Backup::Configuration::Account do
144
145
  before do
145
146
  allow(account).to receive(:"username=")
146
147
  allow(account).to receive(:"server=")
147
- allow(Imap::Backup::Configuration::Asker).
148
+ allow(Imap::Backup::Setup::Asker).
148
149
  to receive(:email) { new_email }
149
150
  subject.run
150
151
  menu.choices["modify email"].call
@@ -218,7 +219,7 @@ describe Imap::Backup::Configuration::Account do
218
219
 
219
220
  before do
220
221
  allow(account).to receive(:"password=")
221
- allow(Imap::Backup::Configuration::Asker).
222
+ allow(Imap::Backup::Setup::Asker).
222
223
  to receive(:password) { new_password }
223
224
  subject.run
224
225
  menu.choices["modify password"].call
@@ -263,7 +264,7 @@ describe Imap::Backup::Configuration::Account do
263
264
  allow(account).to receive(:"local_path=")
264
265
  @validator = nil
265
266
  allow(
266
- Imap::Backup::Configuration::Asker
267
+ Imap::Backup::Setup::Asker
267
268
  ).to receive(:backup_path) do |_path, validator|
268
269
  @validator = validator
269
270
  new_backup_path
@@ -295,11 +296,11 @@ describe Imap::Backup::Configuration::Account do
295
296
 
296
297
  describe "choosing 'choose backup folders'" do
297
298
  let(:chooser) do
298
- instance_double(Imap::Backup::Configuration::FolderChooser, run: nil)
299
+ instance_double(Imap::Backup::Setup::FolderChooser, run: nil)
299
300
  end
300
301
 
301
302
  before do
302
- allow(Imap::Backup::Configuration::FolderChooser).
303
+ allow(Imap::Backup::Setup::FolderChooser).
303
304
  to receive(:new) { chooser }
304
305
  subject.run
305
306
  menu.choices["choose backup folders"].call
@@ -311,17 +312,23 @@ describe Imap::Backup::Configuration::Account do
311
312
  end
312
313
 
313
314
  describe "choosing 'test connection'" do
315
+ let(:connection_tester) do
316
+ instance_double(
317
+ Imap::Backup::Setup::ConnectionTester,
318
+ test: "All fine"
319
+ )
320
+ end
321
+
314
322
  before do
315
- allow(Imap::Backup::Configuration::ConnectionTester).
316
- to receive(:test) { "All fine" }
323
+ allow(Imap::Backup::Setup::ConnectionTester).
324
+ to receive(:new) { connection_tester }
317
325
  allow(highline).to receive(:ask)
318
326
  subject.run
319
327
  menu.choices["test connection"].call
320
328
  end
321
329
 
322
330
  it "tests the connection" do
323
- expect(Imap::Backup::Configuration::ConnectionTester).
324
- to have_received(:test).with(account)
331
+ expect(connection_tester).to have_received(:test)
325
332
  end
326
333
  end
327
334
 
@@ -1,5 +1,5 @@
1
1
  module Imap::Backup
2
- describe Configuration::Asker do
2
+ describe Setup::Asker do
3
3
  subject { described_class.new(highline) }
4
4
 
5
5
  let(:highline) { double }
@@ -16,7 +16,7 @@ module Imap::Backup
16
16
  let(:answer) { "foo" }
17
17
 
18
18
  before do
19
- allow(Configuration::Setup).to receive(:highline) { highline }
19
+ allow(Setup).to receive(:highline) { highline }
20
20
  allow(highline).to receive(:ask) do |&b|
21
21
  b.call query
22
22
  answer
@@ -1,5 +1,7 @@
1
- describe Imap::Backup::Configuration::ConnectionTester do
2
- describe ".test" do
1
+ describe Imap::Backup::Setup::ConnectionTester do
2
+ describe "#test" do
3
+ subject { described_class.new("foo") }
4
+
3
5
  let(:connection) do
4
6
  instance_double(Imap::Backup::Account::Connection, client: nil)
5
7
  end
@@ -8,17 +10,15 @@ describe Imap::Backup::Configuration::ConnectionTester do
8
10
  allow(Imap::Backup::Account::Connection).to receive(:new) { connection }
9
11
  end
10
12
 
11
- describe "call" do
12
- it "tries to connect" do
13
- expect(connection).to receive(:client)
13
+ it "tries to connect" do
14
+ expect(connection).to receive(:client)
14
15
 
15
- subject.test("foo")
16
- end
16
+ subject.test
17
17
  end
18
18
 
19
19
  describe "success" do
20
20
  it "returns success" do
21
- expect(subject.test("foo")).to match(/successful/)
21
+ expect(subject.test).to match(/successful/)
22
22
  end
23
23
  end
24
24
 
@@ -35,7 +35,7 @@ describe Imap::Backup::Configuration::ConnectionTester do
35
35
  end
36
36
 
37
37
  it "returns error" do
38
- expect(subject.test("foo")).to match(/no response/i)
38
+ expect(subject.test).to match(/no response/i)
39
39
  end
40
40
  end
41
41
 
@@ -43,7 +43,7 @@ describe Imap::Backup::Configuration::ConnectionTester do
43
43
  let(:error) { "Error" }
44
44
 
45
45
  it "returns error" do
46
- expect(subject.test("foo")).to match(/unexpected error/i)
46
+ expect(subject.test).to match(/unexpected error/i)
47
47
  end
48
48
  end
49
49
  end
@@ -1,4 +1,4 @@
1
- describe Imap::Backup::Configuration::FolderChooser do
1
+ describe Imap::Backup::Setup::FolderChooser do
2
2
  include HighLineTestHelpers
3
3
 
4
4
  describe "#run" do
@@ -6,7 +6,7 @@ describe Imap::Backup::Configuration::FolderChooser do
6
6
 
7
7
  let(:connection) do
8
8
  instance_double(
9
- Imap::Backup::Account::Connection, folders: connection_folders
9
+ Imap::Backup::Account::Connection, folder_names: connection_folders
10
10
  )
11
11
  end
12
12
  let(:account) do
@@ -25,7 +25,7 @@ describe Imap::Backup::Configuration::FolderChooser do
25
25
  before do
26
26
  allow(Imap::Backup::Account::Connection).to receive(:new) { connection }
27
27
  allow(Kernel).to receive(:system)
28
- allow(Imap::Backup.logger).to receive(:warn)
28
+ allow(Imap::Backup::Logger.logger).to receive(:warn)
29
29
  end
30
30
 
31
31
  describe "display" do
@@ -108,12 +108,12 @@ describe Imap::Backup::Configuration::FolderChooser do
108
108
  let(:connection_folders) { nil }
109
109
 
110
110
  before do
111
- allow(Imap::Backup::Configuration::Setup.highline).
111
+ allow(Imap::Backup::Setup.highline).
112
112
  to receive(:ask) { "q" }
113
113
  end
114
114
 
115
115
  it "asks to press a key" do
116
- expect(Imap::Backup::Configuration::Setup.highline).
116
+ expect(Imap::Backup::Setup.highline).
117
117
  to receive(:ask).with("Press a key ")
118
118
 
119
119
  subject.run
@@ -124,19 +124,19 @@ describe Imap::Backup::Configuration::FolderChooser do
124
124
  before do
125
125
  allow(Imap::Backup::Account::Connection).
126
126
  to receive(:new).with(account).and_raise("error")
127
- allow(Imap::Backup::Configuration::Setup.highline).
127
+ allow(Imap::Backup::Setup.highline).
128
128
  to receive(:ask) { "q" }
129
129
  end
130
130
 
131
131
  it "prints an error message" do
132
- expect(Imap::Backup.logger).
132
+ expect(Imap::Backup::Logger.logger).
133
133
  to receive(:warn).with("Connection failed")
134
134
 
135
135
  subject.run
136
136
  end
137
137
 
138
138
  it "asks to continue" do
139
- expect(Imap::Backup::Configuration::Setup.highline).
139
+ expect(Imap::Backup::Setup.highline).
140
140
  to receive(:ask).with("Press a key ")
141
141
 
142
142
  subject.run
@@ -1,4 +1,4 @@
1
- describe Imap::Backup::Configuration::Setup do
1
+ describe Imap::Backup::Setup do
2
2
  include HighLineTestHelpers
3
3
 
4
4
  subject { described_class.new }
@@ -30,17 +30,17 @@ describe Imap::Backup::Configuration::Setup do
30
30
  let(:accounts) { [normal_account] }
31
31
  let(:store) do
32
32
  instance_double(
33
- Imap::Backup::Configuration::Store,
33
+ Imap::Backup::Configuration,
34
34
  "accounts": accounts,
35
35
  "path": "/base/path",
36
36
  "save": nil,
37
37
  "debug?": debug,
38
38
  "debug=": nil,
39
- "modified?": modified
39
+ "modified?": config_modified
40
40
  )
41
41
  end
42
42
  let(:debug) { false }
43
- let(:modified) { false }
43
+ let(:config_modified) { false }
44
44
  let!(:highline_streams) { prepare_highline }
45
45
  let(:input) { highline_streams[0] }
46
46
  let(:output) { highline_streams[1] }
@@ -56,31 +56,42 @@ describe Imap::Backup::Configuration::Setup do
56
56
 
57
57
  describe "#run" do
58
58
  before do
59
- allow(Imap::Backup::Configuration::Store).to receive(:new) { store }
60
- allow(Imap::Backup).to receive(:setup_logging)
59
+ allow(Imap::Backup::Configuration).to receive(:new) { store }
60
+ allow(Imap::Backup::Logger).to receive(:setup_logging)
61
61
  allow(input).to receive(:eof?) { false }
62
- allow(input).to receive(:gets) { "exit\n" }
62
+ allow(input).to receive(:gets) { "q\n" }
63
63
  allow(Kernel).to receive(:system)
64
64
  end
65
65
 
66
66
  describe "main menu" do
67
- before { subject.run }
67
+ context "when changes have not been made" do
68
+ before { subject.run }
68
69
 
69
- ["add account", "save and exit", "exit without saving"].each do |choice|
70
- it "includes #{choice}" do
71
- expect(output.string).to include(choice)
70
+ ["add account", "quit"].each do |choice|
71
+ it "includes #{choice}" do
72
+ expect(output.string).to include(choice)
73
+ end
72
74
  end
73
75
  end
74
- end
75
76
 
76
- it "clears the screen" do
77
- expect(Kernel).to receive(:system).with("clear")
77
+ context "when changes have been made" do
78
+ let(:config_modified) { true }
78
79
 
79
- subject.run
80
+ before do
81
+ allow(input).to receive(:gets) { "exit\n" }
82
+ subject.run
83
+ end
84
+
85
+ ["save and exit", "exit without saving"].each do |choice|
86
+ it "includes '#{choice}'" do
87
+ expect(output.string).to include(choice)
88
+ end
89
+ end
90
+ end
80
91
  end
81
92
 
82
- it "updates logging status" do
83
- expect(Imap::Backup).to receive(:setup_logging)
93
+ it "clears the screen" do
94
+ expect(Kernel).to receive(:system).with("clear")
84
95
 
85
96
  subject.run
86
97
  end
@@ -111,14 +122,15 @@ describe Imap::Backup::Configuration::Setup do
111
122
 
112
123
  context "when editing accounts" do
113
124
  let(:account) do
114
- instance_double(Imap::Backup::Configuration::Account, run: nil)
125
+ instance_double(Imap::Backup::Setup::Account, run: nil)
115
126
  end
127
+ let(:config_modified) { true }
116
128
 
117
129
  before do
118
130
  allow(input).to receive(:gets).and_return("1\n", "exit\n")
119
- allow(Imap::Backup::Configuration::Asker).to receive(:email).
131
+ allow(Imap::Backup::Setup::Asker).to receive(:email).
120
132
  with(no_args) { "new@example.com" }
121
- allow(Imap::Backup::Configuration::Account).to receive(:new).
133
+ allow(Imap::Backup::Setup::Account).to receive(:new).
122
134
  with(store, normal_account, anything) { account }
123
135
  end
124
136
 
@@ -139,16 +151,17 @@ describe Imap::Backup::Configuration::Setup do
139
151
  }
140
152
  end
141
153
  let(:account) do
142
- instance_double(Imap::Backup::Configuration::Account, run: nil)
154
+ instance_double(Imap::Backup::Setup::Account, run: nil)
143
155
  end
156
+ let(:config_modified) { true }
144
157
  let(:added_email) { "new@example.com" }
145
158
  let(:local_path) { "/base/path/new_example.com" }
146
159
 
147
160
  before do
148
161
  allow(input).to receive(:gets).and_return("add\n", "exit\n")
149
- allow(Imap::Backup::Configuration::Asker).to receive(:email).
162
+ allow(Imap::Backup::Setup::Asker).to receive(:email).
150
163
  with(no_args) { added_email }
151
- allow(Imap::Backup::Configuration::Account).to receive(:new).
164
+ allow(Imap::Backup::Setup::Account).to receive(:new).
152
165
  with(store, anything, anything) { account }
153
166
 
154
167
  subject.run
@@ -186,6 +199,8 @@ describe Imap::Backup::Configuration::Setup do
186
199
 
187
200
  describe "logging" do
188
201
  context "when debug logging is disabled" do
202
+ let(:config_modified) { true }
203
+
189
204
  before do
190
205
  allow(input).to receive(:gets).and_return("start\n", "exit\n")
191
206
  end
@@ -204,7 +219,7 @@ describe Imap::Backup::Configuration::Setup do
204
219
  end
205
220
 
206
221
  it "updates logging status" do
207
- expect(Imap::Backup).to receive(:setup_logging).twice
222
+ expect(Imap::Backup::Logger).to receive(:setup_logging)
208
223
 
209
224
  subject.run
210
225
  end
@@ -213,6 +228,7 @@ describe Imap::Backup::Configuration::Setup do
213
228
 
214
229
  context "when debug logging is enabled" do
215
230
  let(:debug) { true }
231
+ let(:config_modified) { true }
216
232
 
217
233
  before do
218
234
  allow(input).to receive(:gets).and_return("stop\n", "exit\n")
@@ -236,7 +252,7 @@ describe Imap::Backup::Configuration::Setup do
236
252
  end
237
253
 
238
254
  it "updates logging status" do
239
- expect(Imap::Backup).to receive(:setup_logging).twice
255
+ expect(Imap::Backup::Logger).to receive(:setup_logging)
240
256
 
241
257
  subject.run
242
258
  end
@@ -245,6 +261,8 @@ describe Imap::Backup::Configuration::Setup do
245
261
  end
246
262
 
247
263
  context "when 'save' is selected" do
264
+ let(:config_modified) { true }
265
+
248
266
  before do
249
267
  allow(input).to receive(:gets) { "save\n" }
250
268
  end
@@ -262,6 +280,8 @@ describe Imap::Backup::Configuration::Setup do
262
280
  end
263
281
 
264
282
  context "when 'exit without saving' is selected" do
283
+ let(:config_modified) { true }
284
+
265
285
  before do
266
286
  allow(input).to receive(:gets) { "exit\n" }
267
287
  end
@@ -271,22 +291,10 @@ describe Imap::Backup::Configuration::Setup do
271
291
  subject.run
272
292
  end
273
293
 
274
- context "when the configuration is modified" do
275
- let(:modified) { true }
294
+ it "doesn't save the configuration" do
295
+ expect(store).to_not receive(:save)
276
296
 
277
- it "doesn't save the configuration" do
278
- expect(store).to_not receive(:save)
279
-
280
- subject.run
281
- end
282
- end
283
-
284
- context "when the configuration isn't modified" do
285
- it "doesn't save the configuration" do
286
- expect(store).to_not receive(:save)
287
-
288
- subject.run
289
- end
297
+ subject.run
290
298
  end
291
299
  end
292
300
  end