rspec-retry 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -3
- data/README.md +5 -1
- data/changelog.md +7 -0
- data/gemfiles/rspec_3.2.gemfile.lock +1 -4
- data/gemfiles/rspec_3.3.gemfile.lock +1 -4
- data/lib/rspec/retry.rb +10 -1
- data/lib/rspec/retry/version.rb +1 -1
- data/spec/lib/rspec/retry_spec.rb +31 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e09610029e77acbc2b8078041f1e8a73576e98bc
|
4
|
+
data.tar.gz: 5501e72406860b85e1b815f554e8444c465608da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00f879e6b659c0b3520cde2b7cee8ce91d8dd926833a9abb9f90465ec4492ba13ec3f53ad3f94e03872d0f8b25389a83ec17efdef0e9406eadd5a9ef2e66b1fb
|
7
|
+
data.tar.gz: e66de098f53ec1d5c6a6ed7b69b3148a52882abfeb1e6f021fa41024bd9699cb28396f38dda3657a5dbbfec214f209841fa3276f3abf462fbdccf16370b6a4cf
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
# RSpec::Retry
|
1
|
+
# RSpec::Retry ![Build Status](https://secure.travis-ci.org/NoRedInk/rspec-retry.svg?branch=master)
|
2
|
+
|
2
3
|
|
3
4
|
RSpec::Retry adds a ``:retry`` option for intermittently failing rspec examples.
|
4
5
|
If an example has the ``:retry`` option, rspec will retry the example the
|
@@ -52,6 +53,9 @@ end
|
|
52
53
|
- __:clear_lets_on_failure__(default: *true*) Clear memoized values for ``let``s before retrying
|
53
54
|
- __:exceptions_to_retry__(default: *[]*) List of exceptions that will trigger a retry (when empty, all exceptions will)
|
54
55
|
|
56
|
+
## Environment Variables
|
57
|
+
- __RSPEC_RETRY_RETRY_COUNT__ can override the retry counts even if a retry count is set in an example or default_retry_count is set in a configuration.
|
58
|
+
|
55
59
|
## Contributing
|
56
60
|
|
57
61
|
1. Fork it
|
data/changelog.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# 0.4.2 - 2015-7-10
|
2
|
+
## bugfixes
|
3
|
+
setting retry to 0 will still run tests (#34)
|
4
|
+
|
5
|
+
## enhancements
|
6
|
+
can set env variable RSPEC_RETRY_RETRY_COUNT to override anything specified in code (thanks @sunflat, #28, #36)
|
7
|
+
|
1
8
|
# 0.4.1 - 2015-7-9
|
2
9
|
## bugfixes
|
3
10
|
rspec-retry now supports rspec 3.3. (thanks @eitoball, #32)
|
data/lib/rspec/retry.rb
CHANGED
@@ -24,7 +24,16 @@ module RSpec
|
|
24
24
|
|
25
25
|
config.around(:each) do |ex|
|
26
26
|
example = fetch_current_example.call(self)
|
27
|
-
|
27
|
+
|
28
|
+
retry_count = [
|
29
|
+
(
|
30
|
+
ENV['RSPEC_RETRY_RETRY_COUNT'] ||
|
31
|
+
ex.metadata[:retry] ||
|
32
|
+
RSpec.configuration.default_retry_count
|
33
|
+
).to_i,
|
34
|
+
1
|
35
|
+
].max
|
36
|
+
|
28
37
|
sleep_interval = ex.metadata[:retry_wait] || RSpec.configuration.default_sleep_interval
|
29
38
|
exceptions_to_retry = ex.metadata[:exceptions_to_retry] || RSpec.configuration.exceptions_to_retry
|
30
39
|
|
data/lib/rspec/retry/version.rb
CHANGED
@@ -19,6 +19,10 @@ describe RSpec::Retry do
|
|
19
19
|
@expectations.shift
|
20
20
|
end
|
21
21
|
|
22
|
+
before(:all) do
|
23
|
+
ENV.delete('RSPEC_RETRY_RETRY_COUNT')
|
24
|
+
end
|
25
|
+
|
22
26
|
context 'no retry option' do
|
23
27
|
it 'should work' do
|
24
28
|
expect(true).to be(true)
|
@@ -46,6 +50,33 @@ describe RSpec::Retry do
|
|
46
50
|
end
|
47
51
|
end
|
48
52
|
|
53
|
+
context 'with :retry => 0' do
|
54
|
+
after(:all) { @@this_ran_once = nil }
|
55
|
+
it 'should still run once', retry: 0 do
|
56
|
+
@@this_ran_once = true
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should run have run once' do
|
60
|
+
expect(@@this_ran_once).to be true
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context 'with the environment variable RSPEC_RETRY_RETRY_COUNT' do
|
65
|
+
before(:all) do
|
66
|
+
set_expectations([false, false, true])
|
67
|
+
ENV['RSPEC_RETRY_RETRY_COUNT'] = '3'
|
68
|
+
end
|
69
|
+
|
70
|
+
after(:all) do
|
71
|
+
ENV.delete('RSPEC_RETRY_RETRY_COUNT')
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should override the retry count set in an example', :retry => 2 do
|
75
|
+
expect(true).to be(shift_expectation)
|
76
|
+
expect(count).to eq(3)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
49
80
|
describe "with a list of exceptions", :retry => 2, :exceptions_to_retry => [NoMethodError] do
|
50
81
|
context "the example throws an exception contained in the retry list" do
|
51
82
|
it "retries the maximum number of times" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-retry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yusuke Mito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-core
|