rspec-retry 0.5.7 → 0.6.0
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/README.md +5 -3
- data/changelog.md +5 -0
- data/gemfiles/rspec_3.3.gemfile.lock +1 -1
- data/gemfiles/rspec_3.4.gemfile.lock +1 -1
- data/gemfiles/rspec_3.5.gemfile.lock +1 -1
- data/gemfiles/rspec_3.6.gemfile.lock +1 -1
- data/gemfiles/rspec_3.7.gemfile.lock +1 -1
- data/lib/rspec/retry.rb +8 -3
- data/lib/rspec/retry/version.rb +1 -1
- data/spec/lib/rspec/retry_spec.rb +15 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bf1468afddcf01b5636087d6a3d439a36a6a8df9c8101215b397bc2bc5684d5
|
4
|
+
data.tar.gz: 13a446f999361c54a86a5db02ef65893cacad2e80c553bc9bb173a09961c3fd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fac97737f2346315e373ac932f26442652b32a30dac92eae08edb65053aaad2a0155b0a2043b070c56639487fa0cdea7d15e0ec26e0f80b355a4c439fb6c8b6f
|
7
|
+
data.tar.gz: 4a75f75b96fac155424b490ae39d252d0d819cc8f45c5e5e6108b6b1ed002bf0fdff159929ee68aa7af113420d69b02bce5c40a6ed5cf6f0cc7b4354f31c3dde
|
data/README.md
CHANGED
@@ -8,8 +8,8 @@ specified number of times until the example succeeds.
|
|
8
8
|
|
9
9
|
| Rspec Version | Rspec-Retry Version |
|
10
10
|
|---------------|---------------------|
|
11
|
-
| > 3.8 | 0.
|
12
|
-
| > 3.3, <= 3.8 | 0.
|
11
|
+
| > 3.8 | 0.6.0 but untested |
|
12
|
+
| > 3.3, <= 3.8 | 0.6.0 |
|
13
13
|
| 3.2 | 0.4.6 |
|
14
14
|
| 2.14.8 | 0.4.4 |
|
15
15
|
|
@@ -17,7 +17,9 @@ specified number of times until the example succeeds.
|
|
17
17
|
|
18
18
|
Add this line to your application's Gemfile:
|
19
19
|
|
20
|
-
|
20
|
+
```ruby
|
21
|
+
gem 'rspec-retry', group: :test # Unlike rspec, this doesn't need to be included in development group
|
22
|
+
```
|
21
23
|
|
22
24
|
And then execute:
|
23
25
|
|
data/changelog.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# 0.6.0 - 2018-05-15
|
2
|
+
## enhancements
|
3
|
+
add exponential backoff option (thanks @patveith, @thedrow / #91, #94, #95)
|
4
|
+
better documentation (thanks @swrobel / #90)
|
5
|
+
|
1
6
|
# 0.5.7 - 2018-03-13
|
2
7
|
## enhancements
|
3
8
|
remove <3.8 constraint on rspec-core to prevent breaking when rspec-core upgrades (thanks @dthorsen / #89)
|
data/lib/rspec/retry.rb
CHANGED
@@ -9,6 +9,7 @@ module RSpec
|
|
9
9
|
config.add_setting :verbose_retry, :default => false
|
10
10
|
config.add_setting :default_retry_count, :default => 1
|
11
11
|
config.add_setting :default_sleep_interval, :default => 0
|
12
|
+
config.add_setting :exponential_backoff, :default => false
|
12
13
|
config.add_setting :clear_lets_on_failure, :default => true
|
13
14
|
config.add_setting :display_try_failure_messages, :default => false
|
14
15
|
|
@@ -76,8 +77,12 @@ module RSpec
|
|
76
77
|
end
|
77
78
|
|
78
79
|
def sleep_interval
|
79
|
-
ex.metadata[:
|
80
|
-
|
80
|
+
if ex.metadata[:exponential_backoff]
|
81
|
+
2**(current_example.attempts-1) * ex.metadata[:retry_wait]
|
82
|
+
else
|
83
|
+
ex.metadata[:retry_wait] ||
|
84
|
+
RSpec.configuration.default_sleep_interval
|
85
|
+
end
|
81
86
|
end
|
82
87
|
|
83
88
|
def exceptions_to_hard_fail
|
@@ -149,7 +154,7 @@ module RSpec
|
|
149
154
|
example.example_group_instance.instance_exec(example, &RSpec.configuration.retry_callback)
|
150
155
|
end
|
151
156
|
|
152
|
-
sleep sleep_interval if sleep_interval.
|
157
|
+
sleep sleep_interval if sleep_interval.to_f > 0
|
153
158
|
end
|
154
159
|
end
|
155
160
|
|
data/lib/rspec/retry/version.rb
CHANGED
@@ -83,6 +83,21 @@ describe RSpec::Retry do
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
+
context "with exponential backoff enabled", :retry => 3, :retry_wait => 0.001, :exponential_backoff => true do
|
87
|
+
context do
|
88
|
+
before(:all) do
|
89
|
+
set_expectations([false, false, true])
|
90
|
+
@start_time = Time.now
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'should run example until :retry times', :retry => 3 do
|
94
|
+
expect(true).to be(shift_expectation)
|
95
|
+
expect(count).to eq(3)
|
96
|
+
expect(Time.now - @start_time).to be >= (0.001)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
86
101
|
describe "with a list of exceptions to immediately fail on", :retry => 2, :exceptions_to_hard_fail => [HardFailError] do
|
87
102
|
context "the example throws an exception contained in the hard fail list" do
|
88
103
|
it "does not retry" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-retry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yusuke Mito
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-05-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec-core
|
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
136
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.7.
|
137
|
+
rubygems_version: 2.7.6
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: retry intermittently failing rspec examples
|