backup 3.0.26 → 3.0.27
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.
- data/README.md +1 -3
- data/lib/backup/cli/helpers.rb +2 -0
- data/lib/backup/cli/utility.rb +4 -4
- data/lib/backup/compressor/bzip2.rb +8 -4
- data/lib/backup/compressor/gzip.rb +8 -4
- data/lib/backup/configuration/helpers.rb +30 -38
- data/lib/backup/database/mongodb.rb +2 -1
- data/lib/backup/database/mysql.rb +2 -1
- data/lib/backup/database/postgresql.rb +2 -1
- data/lib/backup/database/redis.rb +2 -1
- data/lib/backup/database/riak.rb +2 -1
- data/lib/backup/encryptor/gpg.rb +717 -37
- data/lib/backup/syncer/cloud/base.rb +2 -2
- data/lib/backup/version.rb +1 -1
- data/spec-live/backups/config.rb +14 -84
- data/spec-live/backups/config.yml.template +3 -0
- data/spec-live/backups/models.rb +184 -0
- data/spec-live/encryptor/gpg_keys.rb +239 -0
- data/spec-live/encryptor/gpg_spec.rb +287 -0
- data/spec-live/notifier/mail_spec.rb +58 -22
- data/spec-live/spec_helper.rb +69 -3
- data/spec/cli/helpers_spec.rb +25 -25
- data/spec/cli/utility_spec.rb +6 -3
- data/spec/compressor/bzip2_spec.rb +20 -41
- data/spec/compressor/gzip_spec.rb +20 -41
- data/spec/configuration/helpers_spec.rb +94 -253
- data/spec/database/mongodb_spec.rb +9 -10
- data/spec/database/mysql_spec.rb +9 -10
- data/spec/database/postgresql_spec.rb +9 -10
- data/spec/database/redis_spec.rb +9 -10
- data/spec/database/riak_spec.rb +9 -10
- data/spec/encryptor/gpg_spec.rb +830 -71
- data/spec/storage/dropbox_spec.rb +24 -36
- data/spec/syncer/cloud/base_spec.rb +1 -1
- data/templates/cli/utility/encryptor/gpg +16 -1
- metadata +63 -64
data/spec/cli/helpers_spec.rb
CHANGED
@@ -30,7 +30,7 @@ describe Backup::CLI::Helpers do
|
|
30
30
|
let(:stderr_messages) { '' }
|
31
31
|
|
32
32
|
it 'should return stdout and generate no additional log messages' do
|
33
|
-
helpers.run
|
33
|
+
helpers.send(:run, command).should == ''
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -42,7 +42,7 @@ describe Backup::CLI::Helpers do
|
|
42
42
|
Backup::Logger.expects(:message).with(
|
43
43
|
"cmd_name:STDOUT: out line1\ncmd_name:STDOUT: out line2"
|
44
44
|
)
|
45
|
-
helpers.run
|
45
|
+
helpers.send(:run, command).should == stdout_messages.strip
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -54,7 +54,7 @@ describe Backup::CLI::Helpers do
|
|
54
54
|
Backup::Logger.expects(:warn).with(
|
55
55
|
"cmd_name:STDERR: err line1\ncmd_name:STDERR: err line2"
|
56
56
|
)
|
57
|
-
helpers.run
|
57
|
+
helpers.send(:run, command).should == ''
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -69,7 +69,7 @@ describe Backup::CLI::Helpers do
|
|
69
69
|
Backup::Logger.expects(:warn).with(
|
70
70
|
"cmd_name:STDERR: err line1\ncmd_name:STDERR: err line2"
|
71
71
|
)
|
72
|
-
helpers.run
|
72
|
+
helpers.send(:run, command).should == stdout_messages.strip
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end # context 'when the command is successful'
|
@@ -101,7 +101,7 @@ describe Backup::CLI::Helpers do
|
|
101
101
|
|
102
102
|
it 'should raise an error reporting no messages' do
|
103
103
|
expect do
|
104
|
-
helpers.run
|
104
|
+
helpers.send(:run, command)
|
105
105
|
end.to raise_error {|err|
|
106
106
|
err.message.should == message_head +
|
107
107
|
" STDOUT Messages: None\n" +
|
@@ -116,7 +116,7 @@ describe Backup::CLI::Helpers do
|
|
116
116
|
|
117
117
|
it 'should raise an error and report the stdout messages' do
|
118
118
|
expect do
|
119
|
-
helpers.run
|
119
|
+
helpers.send(:run, command)
|
120
120
|
end.to raise_error {|err|
|
121
121
|
err.message.should == message_head +
|
122
122
|
" STDOUT Messages: \n" +
|
@@ -133,7 +133,7 @@ describe Backup::CLI::Helpers do
|
|
133
133
|
|
134
134
|
it 'should raise an error and report the stderr messages' do
|
135
135
|
expect do
|
136
|
-
helpers.run
|
136
|
+
helpers.send(:run, command)
|
137
137
|
end.to raise_error {|err|
|
138
138
|
err.message.should == message_head +
|
139
139
|
" STDOUT Messages: None\n" +
|
@@ -150,7 +150,7 @@ describe Backup::CLI::Helpers do
|
|
150
150
|
|
151
151
|
it 'should raise an error and report the stdout and stderr messages' do
|
152
152
|
expect do
|
153
|
-
helpers.run
|
153
|
+
helpers.send(:run, command)
|
154
154
|
end.to raise_error {|err|
|
155
155
|
err.message.should == message_head +
|
156
156
|
" STDOUT Messages: \n" +
|
@@ -175,7 +175,7 @@ describe Backup::CLI::Helpers do
|
|
175
175
|
|
176
176
|
it 'should raise an error wrapping the system error raised' do
|
177
177
|
expect do
|
178
|
-
helpers.run
|
178
|
+
helpers.send(:run, command)
|
179
179
|
end.to raise_error {|err|
|
180
180
|
err.message.should == "CLI::SystemCallError: " +
|
181
181
|
"Failed to execute system command on #{ RUBY_PLATFORM }\n" +
|
@@ -193,24 +193,24 @@ describe Backup::CLI::Helpers do
|
|
193
193
|
context 'when a system path for the utility is available' do
|
194
194
|
it 'should return the system path with newline removed' do
|
195
195
|
helpers.expects(:`).with('which foo 2>/dev/null').returns("system_path\n")
|
196
|
-
helpers.
|
196
|
+
helpers.send(:utility, :foo).should == 'system_path'
|
197
197
|
end
|
198
198
|
|
199
199
|
it 'should cache the returned path' do
|
200
200
|
helpers.expects(:`).once.with('which cache_me 2>/dev/null').
|
201
201
|
returns("cached_path\n")
|
202
202
|
|
203
|
-
helpers.
|
204
|
-
helpers.
|
203
|
+
helpers.send(:utility, :cache_me).should == 'cached_path'
|
204
|
+
helpers.send(:utility, :cache_me).should == 'cached_path'
|
205
205
|
end
|
206
206
|
|
207
207
|
it 'should cache the value for all extended objects' do
|
208
208
|
helpers.expects(:`).once.with('which once_only 2>/dev/null').
|
209
209
|
returns("cached_path\n")
|
210
210
|
|
211
|
-
helpers.
|
212
|
-
Class.new.extend(Backup::CLI::Helpers).
|
213
|
-
should == 'cached_path'
|
211
|
+
helpers.send(:utility, :once_only).should == 'cached_path'
|
212
|
+
Class.new.extend(Backup::CLI::Helpers).send(
|
213
|
+
:utility, :once_only).should == 'cached_path'
|
214
214
|
end
|
215
215
|
end
|
216
216
|
|
@@ -219,7 +219,7 @@ describe Backup::CLI::Helpers do
|
|
219
219
|
helpers.expects(:`).with('which unknown 2>/dev/null').returns("\n")
|
220
220
|
|
221
221
|
expect do
|
222
|
-
helpers.
|
222
|
+
helpers.send(:utility, :unknown)
|
223
223
|
end.to raise_error(Backup::Errors::CLI::UtilityNotFoundError) {|err|
|
224
224
|
err.message.should match(/Could not locate 'unknown'/)
|
225
225
|
}
|
@@ -229,13 +229,13 @@ describe Backup::CLI::Helpers do
|
|
229
229
|
helpers.expects(:`).with('which not_cached 2>/dev/null').twice.returns("\n")
|
230
230
|
|
231
231
|
expect do
|
232
|
-
helpers.
|
232
|
+
helpers.send(:utility, :not_cached)
|
233
233
|
end.to raise_error(Backup::Errors::CLI::UtilityNotFoundError) {|err|
|
234
234
|
err.message.should match(/Could not locate 'not_cached'/)
|
235
235
|
}
|
236
236
|
|
237
237
|
expect do
|
238
|
-
helpers.
|
238
|
+
helpers.send(:utility, :not_cached)
|
239
239
|
end.to raise_error(Backup::Errors::CLI::UtilityNotFoundError) {|err|
|
240
240
|
err.message.should match(/Could not locate 'not_cached'/)
|
241
241
|
}
|
@@ -244,7 +244,7 @@ describe Backup::CLI::Helpers do
|
|
244
244
|
|
245
245
|
it 'should raise an error if name is nil' do
|
246
246
|
expect do
|
247
|
-
helpers.utility
|
247
|
+
helpers.send(:utility, nil)
|
248
248
|
end.to raise_error(
|
249
249
|
Backup::Errors::CLI::UtilityNotFoundError,
|
250
250
|
'CLI::UtilityNotFoundError: Utility Name Empty'
|
@@ -253,7 +253,7 @@ describe Backup::CLI::Helpers do
|
|
253
253
|
|
254
254
|
it 'should raise an error if name is empty' do
|
255
255
|
expect do
|
256
|
-
helpers.utility
|
256
|
+
helpers.send(:utility, ' ')
|
257
257
|
end.to raise_error(
|
258
258
|
Backup::Errors::CLI::UtilityNotFoundError,
|
259
259
|
'CLI::UtilityNotFoundError: Utility Name Empty'
|
@@ -265,35 +265,35 @@ describe Backup::CLI::Helpers do
|
|
265
265
|
context 'given a command line path with no arguments' do
|
266
266
|
it 'should return the base command name' do
|
267
267
|
cmd = '/path/to/a/command'
|
268
|
-
helpers.command_name
|
268
|
+
helpers.send(:command_name, cmd).should == 'command'
|
269
269
|
end
|
270
270
|
end
|
271
271
|
|
272
272
|
context 'given a command line path with a single argument' do
|
273
273
|
it 'should return the base command name' do
|
274
274
|
cmd = '/path/to/a/command with_args'
|
275
|
-
helpers.command_name
|
275
|
+
helpers.send(:command_name, cmd).should == 'command'
|
276
276
|
end
|
277
277
|
end
|
278
278
|
|
279
279
|
context 'given a command line path with multiple arguments' do
|
280
280
|
it 'should return the base command name' do
|
281
281
|
cmd = '/path/to/a/command with multiple args'
|
282
|
-
helpers.command_name
|
282
|
+
helpers.send(:command_name, cmd).should == 'command'
|
283
283
|
end
|
284
284
|
end
|
285
285
|
|
286
286
|
context 'given a command with no path and arguments' do
|
287
287
|
it 'should return the base command name' do
|
288
288
|
cmd = 'command args'
|
289
|
-
helpers.command_name
|
289
|
+
helpers.send(:command_name, cmd).should == 'command'
|
290
290
|
end
|
291
291
|
end
|
292
292
|
|
293
293
|
context 'given a command with no path and no arguments' do
|
294
294
|
it 'should return the base command name' do
|
295
295
|
cmd = 'command'
|
296
|
-
helpers.command_name
|
296
|
+
helpers.send(:command_name, cmd).should == 'command'
|
297
297
|
end
|
298
298
|
end
|
299
299
|
end # describe '#command_name'
|
data/spec/cli/utility_spec.rb
CHANGED
@@ -19,12 +19,13 @@ describe 'Backup::CLI::Utility' do
|
|
19
19
|
it 'should perform the backup for the given trigger' do
|
20
20
|
Backup::Logger.expects(:quiet=).in_sequence(s)
|
21
21
|
Backup::Config.expects(:update).in_sequence(s)
|
22
|
-
Backup::Config.expects(:load_config!).in_sequence(s)
|
23
22
|
|
24
23
|
FileUtils.expects(:mkdir_p).in_sequence(s).with(Backup::Config.log_path)
|
25
24
|
FileUtils.expects(:mkdir_p).in_sequence(s).with(Backup::Config.cache_path)
|
26
25
|
FileUtils.expects(:mkdir_p).in_sequence(s).with(Backup::Config.tmp_path)
|
27
26
|
|
27
|
+
Backup::Config.expects(:load_config!).in_sequence(s)
|
28
|
+
|
28
29
|
Backup::Logger.expects(:truncate!)
|
29
30
|
|
30
31
|
model_a.expects(:prepare!).in_sequence(s)
|
@@ -40,12 +41,13 @@ describe 'Backup::CLI::Utility' do
|
|
40
41
|
it 'should perform backups for the multiple triggers' do
|
41
42
|
Backup::Logger.expects(:quiet=).in_sequence(s)
|
42
43
|
Backup::Config.expects(:update).in_sequence(s)
|
43
|
-
Backup::Config.expects(:load_config!).in_sequence(s)
|
44
44
|
|
45
45
|
FileUtils.expects(:mkdir_p).in_sequence(s).with(Backup::Config.log_path)
|
46
46
|
FileUtils.expects(:mkdir_p).in_sequence(s).with(Backup::Config.cache_path)
|
47
47
|
FileUtils.expects(:mkdir_p).in_sequence(s).with(Backup::Config.tmp_path)
|
48
48
|
|
49
|
+
Backup::Config.expects(:load_config!).in_sequence(s)
|
50
|
+
|
49
51
|
Backup::Logger.expects(:truncate!)
|
50
52
|
|
51
53
|
model_a.expects(:prepare!).in_sequence(s)
|
@@ -65,12 +67,13 @@ describe 'Backup::CLI::Utility' do
|
|
65
67
|
it 'should perform backups for the multiple triggers when using wildcard' do
|
66
68
|
Backup::Logger.expects(:quiet=).in_sequence(s)
|
67
69
|
Backup::Config.expects(:update).in_sequence(s)
|
68
|
-
Backup::Config.expects(:load_config!).in_sequence(s)
|
69
70
|
|
70
71
|
FileUtils.expects(:mkdir_p).in_sequence(s).with(Backup::Config.log_path)
|
71
72
|
FileUtils.expects(:mkdir_p).in_sequence(s).with(Backup::Config.cache_path)
|
72
73
|
FileUtils.expects(:mkdir_p).in_sequence(s).with(Backup::Config.tmp_path)
|
73
74
|
|
75
|
+
Backup::Config.expects(:load_config!).in_sequence(s)
|
76
|
+
|
74
77
|
Backup::Logger.expects(:truncate!)
|
75
78
|
|
76
79
|
model_a.expects(:prepare!).in_sequence(s)
|
@@ -71,20 +71,20 @@ describe Backup::Compressor::Bzip2 do
|
|
71
71
|
describe 'fast and best options' do
|
72
72
|
context 'when only the fast option is used' do
|
73
73
|
before do
|
74
|
-
Backup::Logger.expects(:warn).with
|
75
|
-
|
76
|
-
|
74
|
+
Backup::Logger.expects(:warn).with {|err|
|
75
|
+
err.should be_an_instance_of Backup::Errors::ConfigurationError
|
76
|
+
err.message.should match(
|
77
|
+
/Use Bzip2#level instead/
|
78
|
+
)
|
79
|
+
}
|
77
80
|
end
|
78
81
|
|
79
82
|
context 'when set to true' do
|
80
83
|
it 'should log a warning and set `level` to 1' do
|
81
|
-
Backup::Logger.expects(:warn).with(
|
82
|
-
"Backup::Compressor::Bzip2.level is being set to '1'"
|
83
|
-
)
|
84
84
|
compressor = Backup::Compressor::Bzip2.new do |c|
|
85
85
|
c.fast = true
|
86
86
|
end
|
87
|
-
compressor.level.should
|
87
|
+
compressor.level.should == 1
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -100,20 +100,20 @@ describe Backup::Compressor::Bzip2 do
|
|
100
100
|
|
101
101
|
context 'when only the best option is used' do
|
102
102
|
before do
|
103
|
-
Backup::Logger.expects(:warn).with
|
104
|
-
|
105
|
-
|
103
|
+
Backup::Logger.expects(:warn).with {|err|
|
104
|
+
err.should be_an_instance_of Backup::Errors::ConfigurationError
|
105
|
+
err.message.should match(
|
106
|
+
/Use Bzip2#level instead/
|
107
|
+
)
|
108
|
+
}
|
106
109
|
end
|
107
110
|
|
108
111
|
context 'when set to true' do
|
109
112
|
it 'should log a warning and set `level` to 1' do
|
110
|
-
Backup::Logger.expects(:warn).with(
|
111
|
-
"Backup::Compressor::Bzip2.level is being set to '9'"
|
112
|
-
)
|
113
113
|
compressor = Backup::Compressor::Bzip2.new do |c|
|
114
114
|
c.best = true
|
115
115
|
end
|
116
|
-
compressor.level.should
|
116
|
+
compressor.level.should == 9
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
@@ -130,20 +130,17 @@ describe Backup::Compressor::Bzip2 do
|
|
130
130
|
|
131
131
|
context 'when both fast and best options are used' do
|
132
132
|
before do
|
133
|
-
Backup::Logger.expects(:warn).twice.with
|
134
|
-
|
135
|
-
|
133
|
+
Backup::Logger.expects(:warn).twice.with {|err|
|
134
|
+
err.should be_an_instance_of Backup::Errors::ConfigurationError
|
135
|
+
err.message.should match(
|
136
|
+
/Use Bzip2#level instead/
|
137
|
+
)
|
138
|
+
}
|
136
139
|
end
|
137
140
|
|
138
141
|
context 'when both are set true' do
|
139
142
|
context 'when fast is set first' do
|
140
143
|
it 'should cause the best option to be set' do
|
141
|
-
Backup::Logger.expects(:warn).with(
|
142
|
-
"Backup::Compressor::Bzip2.level is being set to '1'"
|
143
|
-
)
|
144
|
-
Backup::Logger.expects(:warn).with(
|
145
|
-
"Backup::Compressor::Bzip2.level is being set to '9'"
|
146
|
-
)
|
147
144
|
compressor = Backup::Compressor::Bzip2.new do |c|
|
148
145
|
c.fast = true
|
149
146
|
c.best = true
|
@@ -154,12 +151,6 @@ describe Backup::Compressor::Bzip2 do
|
|
154
151
|
|
155
152
|
context 'when best is set first' do
|
156
153
|
it 'should cause the fast option to be set' do
|
157
|
-
Backup::Logger.expects(:warn).with(
|
158
|
-
"Backup::Compressor::Bzip2.level is being set to '1'"
|
159
|
-
)
|
160
|
-
Backup::Logger.expects(:warn).with(
|
161
|
-
"Backup::Compressor::Bzip2.level is being set to '9'"
|
162
|
-
)
|
163
154
|
compressor = Backup::Compressor::Bzip2.new do |c|
|
164
155
|
c.best = true
|
165
156
|
c.fast = true
|
@@ -172,9 +163,6 @@ describe Backup::Compressor::Bzip2 do
|
|
172
163
|
context 'when only one is set true' do
|
173
164
|
context 'when fast is set true before best' do
|
174
165
|
it 'should cause the fast option to be set' do
|
175
|
-
Backup::Logger.expects(:warn).with(
|
176
|
-
"Backup::Compressor::Bzip2.level is being set to '1'"
|
177
|
-
)
|
178
166
|
compressor = Backup::Compressor::Bzip2.new do |c|
|
179
167
|
c.fast = true
|
180
168
|
c.best = false
|
@@ -185,9 +173,6 @@ describe Backup::Compressor::Bzip2 do
|
|
185
173
|
|
186
174
|
context 'when fast is set true after best' do
|
187
175
|
it 'should cause the fast option to be set' do
|
188
|
-
Backup::Logger.expects(:warn).with(
|
189
|
-
"Backup::Compressor::Bzip2.level is being set to '1'"
|
190
|
-
)
|
191
176
|
compressor = Backup::Compressor::Bzip2.new do |c|
|
192
177
|
c.best = false
|
193
178
|
c.fast = true
|
@@ -198,9 +183,6 @@ describe Backup::Compressor::Bzip2 do
|
|
198
183
|
|
199
184
|
context 'when best is set true before fast' do
|
200
185
|
it 'should cause the best option to be set' do
|
201
|
-
Backup::Logger.expects(:warn).with(
|
202
|
-
"Backup::Compressor::Bzip2.level is being set to '9'"
|
203
|
-
)
|
204
186
|
compressor = Backup::Compressor::Bzip2.new do |c|
|
205
187
|
c.best = true
|
206
188
|
c.fast = false
|
@@ -211,9 +193,6 @@ describe Backup::Compressor::Bzip2 do
|
|
211
193
|
|
212
194
|
context 'when best is set true after fast' do
|
213
195
|
it 'should cause the best option to be set' do
|
214
|
-
Backup::Logger.expects(:warn).with(
|
215
|
-
"Backup::Compressor::Bzip2.level is being set to '9'"
|
216
|
-
)
|
217
196
|
compressor = Backup::Compressor::Bzip2.new do |c|
|
218
197
|
c.fast = false
|
219
198
|
c.best = true
|
@@ -71,20 +71,20 @@ describe Backup::Compressor::Gzip do
|
|
71
71
|
describe 'fast and best options' do
|
72
72
|
context 'when only the fast option is used' do
|
73
73
|
before do
|
74
|
-
Backup::Logger.expects(:warn).with
|
75
|
-
|
76
|
-
|
74
|
+
Backup::Logger.expects(:warn).with {|err|
|
75
|
+
err.should be_an_instance_of Backup::Errors::ConfigurationError
|
76
|
+
err.message.should match(
|
77
|
+
/Use Gzip#level instead/
|
78
|
+
)
|
79
|
+
}
|
77
80
|
end
|
78
81
|
|
79
82
|
context 'when set to true' do
|
80
83
|
it 'should log a warning and set `level` to 1' do
|
81
|
-
Backup::Logger.expects(:warn).with(
|
82
|
-
"Backup::Compressor::Gzip.level is being set to '1'"
|
83
|
-
)
|
84
84
|
compressor = Backup::Compressor::Gzip.new do |c|
|
85
85
|
c.fast = true
|
86
86
|
end
|
87
|
-
compressor.level.should
|
87
|
+
compressor.level.should == 1
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -100,20 +100,20 @@ describe Backup::Compressor::Gzip do
|
|
100
100
|
|
101
101
|
context 'when only the best option is used' do
|
102
102
|
before do
|
103
|
-
Backup::Logger.expects(:warn).with
|
104
|
-
|
105
|
-
|
103
|
+
Backup::Logger.expects(:warn).with {|err|
|
104
|
+
err.should be_an_instance_of Backup::Errors::ConfigurationError
|
105
|
+
err.message.should match(
|
106
|
+
/Use Gzip#level instead/
|
107
|
+
)
|
108
|
+
}
|
106
109
|
end
|
107
110
|
|
108
111
|
context 'when set to true' do
|
109
112
|
it 'should log a warning and set `level` to 1' do
|
110
|
-
Backup::Logger.expects(:warn).with(
|
111
|
-
"Backup::Compressor::Gzip.level is being set to '9'"
|
112
|
-
)
|
113
113
|
compressor = Backup::Compressor::Gzip.new do |c|
|
114
114
|
c.best = true
|
115
115
|
end
|
116
|
-
compressor.level.should
|
116
|
+
compressor.level.should == 9
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
@@ -130,20 +130,17 @@ describe Backup::Compressor::Gzip do
|
|
130
130
|
|
131
131
|
context 'when both fast and best options are used' do
|
132
132
|
before do
|
133
|
-
Backup::Logger.expects(:warn).twice.with
|
134
|
-
|
135
|
-
|
133
|
+
Backup::Logger.expects(:warn).twice.with {|err|
|
134
|
+
err.should be_an_instance_of Backup::Errors::ConfigurationError
|
135
|
+
err.message.should match(
|
136
|
+
/Use Gzip#level instead/
|
137
|
+
)
|
138
|
+
}
|
136
139
|
end
|
137
140
|
|
138
141
|
context 'when both are set true' do
|
139
142
|
context 'when fast is set first' do
|
140
143
|
it 'should cause the best option to be set' do
|
141
|
-
Backup::Logger.expects(:warn).with(
|
142
|
-
"Backup::Compressor::Gzip.level is being set to '1'"
|
143
|
-
)
|
144
|
-
Backup::Logger.expects(:warn).with(
|
145
|
-
"Backup::Compressor::Gzip.level is being set to '9'"
|
146
|
-
)
|
147
144
|
compressor = Backup::Compressor::Gzip.new do |c|
|
148
145
|
c.fast = true
|
149
146
|
c.best = true
|
@@ -154,12 +151,6 @@ describe Backup::Compressor::Gzip do
|
|
154
151
|
|
155
152
|
context 'when best is set first' do
|
156
153
|
it 'should cause the fast option to be set' do
|
157
|
-
Backup::Logger.expects(:warn).with(
|
158
|
-
"Backup::Compressor::Gzip.level is being set to '1'"
|
159
|
-
)
|
160
|
-
Backup::Logger.expects(:warn).with(
|
161
|
-
"Backup::Compressor::Gzip.level is being set to '9'"
|
162
|
-
)
|
163
154
|
compressor = Backup::Compressor::Gzip.new do |c|
|
164
155
|
c.best = true
|
165
156
|
c.fast = true
|
@@ -172,9 +163,6 @@ describe Backup::Compressor::Gzip do
|
|
172
163
|
context 'when only one is set true' do
|
173
164
|
context 'when fast is set true before best' do
|
174
165
|
it 'should cause the fast option to be set' do
|
175
|
-
Backup::Logger.expects(:warn).with(
|
176
|
-
"Backup::Compressor::Gzip.level is being set to '1'"
|
177
|
-
)
|
178
166
|
compressor = Backup::Compressor::Gzip.new do |c|
|
179
167
|
c.fast = true
|
180
168
|
c.best = false
|
@@ -185,9 +173,6 @@ describe Backup::Compressor::Gzip do
|
|
185
173
|
|
186
174
|
context 'when fast is set true after best' do
|
187
175
|
it 'should cause the fast option to be set' do
|
188
|
-
Backup::Logger.expects(:warn).with(
|
189
|
-
"Backup::Compressor::Gzip.level is being set to '1'"
|
190
|
-
)
|
191
176
|
compressor = Backup::Compressor::Gzip.new do |c|
|
192
177
|
c.best = false
|
193
178
|
c.fast = true
|
@@ -198,9 +183,6 @@ describe Backup::Compressor::Gzip do
|
|
198
183
|
|
199
184
|
context 'when best is set true before fast' do
|
200
185
|
it 'should cause the best option to be set' do
|
201
|
-
Backup::Logger.expects(:warn).with(
|
202
|
-
"Backup::Compressor::Gzip.level is being set to '9'"
|
203
|
-
)
|
204
186
|
compressor = Backup::Compressor::Gzip.new do |c|
|
205
187
|
c.best = true
|
206
188
|
c.fast = false
|
@@ -211,9 +193,6 @@ describe Backup::Compressor::Gzip do
|
|
211
193
|
|
212
194
|
context 'when best is set true after fast' do
|
213
195
|
it 'should cause the best option to be set' do
|
214
|
-
Backup::Logger.expects(:warn).with(
|
215
|
-
"Backup::Compressor::Gzip.level is being set to '9'"
|
216
|
-
)
|
217
196
|
compressor = Backup::Compressor::Gzip.new do |c|
|
218
197
|
c.fast = false
|
219
198
|
c.best = true
|