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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c19ae33ed54ab80271637c93ccbeb531232594e0
4
- data.tar.gz: 91fc35217d5f4a63b07253eaa004aa2db75fa065
3
+ metadata.gz: e09610029e77acbc2b8078041f1e8a73576e98bc
4
+ data.tar.gz: 5501e72406860b85e1b815f554e8444c465608da
5
5
  SHA512:
6
- metadata.gz: af562a7ddf0e16a81f0e1f48f929490435a295539628c03cccd5e28292dda1f1d630409237228aca454a5e370e64c4bf7583836548859e6d2680af7c0c109973
7
- data.tar.gz: 5cda4707019bee75187d3d046d9471344e4abbfdcd76435a40bf8fa28d01a6964e8f41fa066e29dafa88fa3acc86954d3001a51ddd3115a4aa0996b15cbfa0d0
6
+ metadata.gz: 00f879e6b659c0b3520cde2b7cee8ce91d8dd926833a9abb9f90465ec4492ba13ec3f53ad3f94e03872d0f8b25389a83ec17efdef0e9406eadd5a9ef2e66b1fb
7
+ data.tar.gz: e66de098f53ec1d5c6a6ed7b69b3148a52882abfeb1e6f021fa41024bd9699cb28396f38dda3657a5dbbfec214f209841fa3276f3abf462fbdccf16370b6a4cf
data/.travis.yml CHANGED
@@ -5,6 +5,5 @@ rvm:
5
5
  gemfile:
6
6
  - gemfiles/rspec_3.2.gemfile
7
7
  - gemfiles/rspec_3.3.gemfile
8
- before_install: gem update --remote bundler
9
- script:
10
- - bundle exec rake spec
8
+ cache: bundler
9
+ sudo: false
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)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- rspec-retry (0.4.0)
4
+ rspec-retry (0.4.2)
5
5
  rspec-core
6
6
 
7
7
  GEM
@@ -78,6 +78,3 @@ DEPENDENCIES
78
78
  pry-byebug
79
79
  rspec (~> 3.2.0)
80
80
  rspec-retry!
81
-
82
- BUNDLED WITH
83
- 1.10.5
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- rspec-retry (0.4.0)
4
+ rspec-retry (0.4.2)
5
5
  rspec-core
6
6
 
7
7
  GEM
@@ -78,6 +78,3 @@ DEPENDENCIES
78
78
  pry-byebug
79
79
  rspec (~> 3.3.0)
80
80
  rspec-retry!
81
-
82
- BUNDLED WITH
83
- 1.10.5
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
- retry_count = ex.metadata[:retry] || RSpec.configuration.default_retry_count
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
 
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  class Retry
3
- VERSION = "0.4.1"
3
+ VERSION = "0.4.2"
4
4
  end
5
5
  end
@@ -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.1
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-09 00:00:00.000000000 Z
11
+ date: 2015-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core