attempt_this 1.0.2 → 1.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 +4 -4
- data/.gitignore +0 -2
- data/Gemfile.lock +40 -0
- data/attempt_this.gemspec +2 -5
- data/lib/attempt_this/attempt_object.rb +2 -2
- data/lib/attempt_this/attempt_this.rb +1 -1
- data/spec/attempt_spec.rb +14 -14
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3968d36f62f0daef42d12a084a47651d46e39dbe
|
4
|
+
data.tar.gz: 643601bd9c2085b169500b0e98f95cdae62e6dd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddf00b0745662ff6e803184c54c2832ef528e139e0b59c8704c37ea32a92d95169db440b1e7594b97fd0dbc63ed7562f62ad8fd9091aa406b5e1fb6ba3c9ab75
|
7
|
+
data.tar.gz: c9cc0ccc5fdfcfc545522283b614ff52f1f4b21bfc11cce51caf2cafa8760202e192d7d55e47ee78e7c4e8ff1530910e905be58e6bfa25a62274c2a9f5b6433b
|
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
attempt_this (1.0.3)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.2.4)
|
10
|
+
docile (1.1.2)
|
11
|
+
multi_json (1.8.4)
|
12
|
+
rake (10.1.1)
|
13
|
+
rspec (2.13.0)
|
14
|
+
rspec-core (~> 2.13.0)
|
15
|
+
rspec-expectations (~> 2.13.0)
|
16
|
+
rspec-mocks (~> 2.13.0)
|
17
|
+
rspec-core (2.13.1)
|
18
|
+
rspec-expectations (2.13.0)
|
19
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
20
|
+
rspec-mocks (2.13.1)
|
21
|
+
simplecov (0.8.2)
|
22
|
+
docile (~> 1.1.0)
|
23
|
+
multi_json
|
24
|
+
simplecov-html (~> 0.8.0)
|
25
|
+
simplecov-html (0.8.0)
|
26
|
+
|
27
|
+
PLATFORMS
|
28
|
+
java
|
29
|
+
ruby
|
30
|
+
x86-mingw32
|
31
|
+
|
32
|
+
DEPENDENCIES
|
33
|
+
attempt_this!
|
34
|
+
bundler (~> 1.6)
|
35
|
+
rake (~> 10.1)
|
36
|
+
rspec (~> 2.13)
|
37
|
+
simplecov (~> 0.8)
|
38
|
+
|
39
|
+
BUNDLED WITH
|
40
|
+
1.10.6
|
data/attempt_this.gemspec
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
-
lib = File.expand_path('../lib', __FILE__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
|
4
1
|
Gem::Specification.new do |s|
|
5
2
|
s.name = 'attempt_this'
|
6
|
-
s.version = '1.0.
|
7
|
-
s.date = '2015-
|
3
|
+
s.version = '1.0.3'
|
4
|
+
s.date = '2015-10-26'
|
8
5
|
s.summary = 'Retry policy mix-in'
|
9
6
|
s.description = <<EOM
|
10
7
|
Retry policy mix-in with configurable number of attempts, delays, exception filters, and fall back strategies.
|
data/spec/attempt_spec.rb
CHANGED
@@ -15,7 +15,7 @@ describe AttemptThis do
|
|
15
15
|
it 'should execute code block' do
|
16
16
|
was_called = false
|
17
17
|
attempt(1.times) {was_called = true}
|
18
|
-
was_called.should
|
18
|
+
was_called.should be_true
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should execute the code block only once' do
|
@@ -87,7 +87,7 @@ describe AttemptThis do
|
|
87
87
|
attempt(3.times).with_delay(1) do
|
88
88
|
was_called = true
|
89
89
|
end
|
90
|
-
was_called.should
|
90
|
+
was_called.should be_true
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'should not sleep on success' do
|
@@ -151,7 +151,7 @@ describe AttemptThis do
|
|
151
151
|
was_called = false
|
152
152
|
attempt(1.times).with_reset(lambda{}) { was_called = true }
|
153
153
|
|
154
|
-
was_called.should
|
154
|
+
was_called.should be_true
|
155
155
|
end
|
156
156
|
|
157
157
|
it 'should reject multiple reset procs' do
|
@@ -162,7 +162,7 @@ describe AttemptThis do
|
|
162
162
|
was_called = false
|
163
163
|
|
164
164
|
attempt(1.times).with_reset(lambda{ was_called = true }) {}
|
165
|
-
was_called.should
|
165
|
+
was_called.should be_false
|
166
166
|
end
|
167
167
|
|
168
168
|
it 'should be called on each failure' do
|
@@ -190,13 +190,13 @@ describe AttemptThis do
|
|
190
190
|
was_called = false
|
191
191
|
attempt(3.times).and_default_to(lambda{}){ was_called = true }
|
192
192
|
|
193
|
-
was_called.should
|
193
|
+
was_called.should be_true
|
194
194
|
end
|
195
195
|
|
196
196
|
it 'should not be called on success' do
|
197
197
|
was_called = false
|
198
198
|
attempt(3.times).and_default_to(lambda{ was_called = true }) {}
|
199
|
-
was_called.should
|
199
|
+
was_called.should be_false
|
200
200
|
end
|
201
201
|
|
202
202
|
it 'should be called once on the failure' do
|
@@ -211,7 +211,7 @@ describe AttemptThis do
|
|
211
211
|
was_called = false
|
212
212
|
|
213
213
|
attempt(3.times).and_default_to(lambda{ was_called = true }) { call_count += 1; raise 'Test' if call_count < 2 }
|
214
|
-
was_called.should
|
214
|
+
was_called.should be_false
|
215
215
|
end
|
216
216
|
end
|
217
217
|
|
@@ -244,7 +244,7 @@ describe AttemptThis do
|
|
244
244
|
was_called = false
|
245
245
|
|
246
246
|
attempt(3.times).with_binary_backoff(1) { was_called = true }
|
247
|
-
was_called.should
|
247
|
+
was_called.should be_true
|
248
248
|
end
|
249
249
|
|
250
250
|
it 'should double delay on each failure' do
|
@@ -272,7 +272,7 @@ describe AttemptThis do
|
|
272
272
|
it 'should call code within the block' do
|
273
273
|
was_called = false
|
274
274
|
attempt(2.times).with_filter(Exception){ was_called = true }
|
275
|
-
was_called.should
|
275
|
+
was_called.should be_true
|
276
276
|
end
|
277
277
|
|
278
278
|
it 'should ignore other exceptions' do
|
@@ -302,29 +302,29 @@ describe AttemptThis do
|
|
302
302
|
subject{TestAttempt.new}
|
303
303
|
|
304
304
|
it 'should be true initially' do
|
305
|
-
subject.enabled?.should
|
305
|
+
subject.enabled?.should be_true
|
306
306
|
end
|
307
307
|
|
308
308
|
it 'should accept true' do
|
309
309
|
subject.enabled = true
|
310
|
-
subject.enabled?.should
|
310
|
+
subject.enabled?.should be_true
|
311
311
|
end
|
312
312
|
|
313
313
|
it 'should accept false' do
|
314
314
|
subject.enabled = false
|
315
|
-
subject.enabled?.should
|
315
|
+
subject.enabled?.should be_false
|
316
316
|
end
|
317
317
|
|
318
318
|
it 'should change from true to false' do
|
319
319
|
subject.enabled = true
|
320
320
|
subject.enabled = false
|
321
|
-
subject.enabled?.should
|
321
|
+
subject.enabled?.should be_false
|
322
322
|
end
|
323
323
|
|
324
324
|
it 'should change from false to true' do
|
325
325
|
subject.enabled = false
|
326
326
|
subject.enabled = true
|
327
|
-
subject.enabled?.should
|
327
|
+
subject.enabled?.should be_true
|
328
328
|
end
|
329
329
|
|
330
330
|
context 'when disabled' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attempt_this
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aliaksei Baturytski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- .gitignore
|
79
79
|
- .travis.yml
|
80
80
|
- Gemfile
|
81
|
+
- Gemfile.lock
|
81
82
|
- README.md
|
82
83
|
- Rakefile
|
83
84
|
- attempt_this.gemspec
|