rspec-retry 0.5.4 → 0.5.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aec2be6f363969a41abb061a144852a46eea0a36
4
- data.tar.gz: 790dc483cac3e6ed3189f4215a8c26c4448aa938
3
+ metadata.gz: dca64362c60cb3455ecec73b8f5fb760fefa9029
4
+ data.tar.gz: 5c991d6261c1feb4d65771d1e0ea81edf24be3d6
5
5
  SHA512:
6
- metadata.gz: fe4900394a7f08e3b464fbfd606d34afa65173678f7886b0aa5199f9857c4dbd226f4494d64009d4ae315dd3b84d3cdba98b20105244b4d989615b4ced8952ab
7
- data.tar.gz: 1bf699cb3c3d56a6354e5973052a81905b4c7095f8a3a7f87482c6038f686112134c1a26ac45ea57b381f240105ce38ce75e09c9b7f48dcec099d988db75d8db
6
+ metadata.gz: f0bf9d0ea831e5bb0eaf23d246bbe625e1697bc08a5c4628e03cc00a042e3d5c4e94d6c1efc9cc105dd3402bd6921031d2a8ccab60bb1750b235f89dc7085e83
7
+ data.tar.gz: a1760e15d92bd00682ae9ea9eea1993777c28f5c5a7d8f6c0ef90a09fb17eb70939f5e9fabeff17edbf533e9c85b94b6b680fb63716c34f93b5312ca257e718d
data/README.md CHANGED
@@ -4,7 +4,13 @@ RSpec::Retry adds a ``:retry`` option for intermittently failing rspec examples.
4
4
  If an example has the ``:retry`` option, rspec will retry the example the
5
5
  specified number of times until the example succeeds.
6
6
 
7
- 0.5.* is compatible with rspec 3.3-3.6* for 3.2 support, use 0.4.6. For older rspec, ymmv.
7
+ ### Compatibility
8
+
9
+ | Rspec Version | Rspec-Retry Version |
10
+ |---------------|---------------------|
11
+ | 3.3-3.6       | 0.5.5             |
12
+ | 3.2       | 0.4.6             |
13
+ | 2.14.8       | 0.4.4             |
8
14
 
9
15
  ## Installation
10
16
 
@@ -36,6 +42,14 @@ RSpec.configure do |config|
36
42
  config.around :each, :js do |ex|
37
43
  ex.run_with_retry retry: 3
38
44
  end
45
+
46
+ # callback to be run between retries
47
+ config.retry_callback = proc do |ex|
48
+ # run some additional clean up task - can be filtered by example metadata
49
+ if ex.metadata[:js]
50
+ Capybara.reset!
51
+ end
52
+ end
39
53
  end
40
54
  ```
41
55
 
@@ -67,6 +81,8 @@ You can call `ex.run_with_retry(opts)` on an individual example.
67
81
  - __:clear_lets_on_failure__(default: *true*) Clear memoized values for ``let``s before retrying
68
82
  - __:exceptions_to_hard_fail__(default: *[]*) List of exceptions that will trigger an immediate test failure without retry. Takes precedence over __:exceptions_to_retry__
69
83
  - __:exceptions_to_retry__(default: *[]*) List of exceptions that will trigger a retry (when empty, all exceptions will)
84
+ - __:retry_callback__(default: *nil*) Callback function to be called between retries
85
+
70
86
 
71
87
  ## Environment Variables
72
88
  - __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.
@@ -1,3 +1,7 @@
1
+ # 0.5.4 - 2017-08-22
2
+ ## enhancements
3
+ added retry_callback to help with cleanup between runs (thanks @abrom / #80)
4
+
1
5
  # 0.5.4 - 2017-05-08
2
6
  ## enhancements
3
7
  added support for rspec 3.6.0 (thanks @dthorsen / #76)
@@ -4,4 +4,4 @@ source "https://rubygems.org"
4
4
 
5
5
  gem "rspec", "~> 3.3.0"
6
6
 
7
- gemspec :path => "../"
7
+ gemspec path: "../"
@@ -1,25 +1,25 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rspec-retry (0.5.4)
4
+ rspec-retry (0.5.5)
5
5
  rspec-core (> 3.3, < 3.7)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- appraisal (2.1.0)
10
+ appraisal (2.2.0)
11
11
  bundler
12
12
  rake
13
13
  thor (>= 0.14.0)
14
14
  byebug (9.0.6)
15
15
  coderay (1.1.1)
16
- diff-lcs (1.2.5)
16
+ diff-lcs (1.3)
17
17
  method_source (0.8.2)
18
18
  pry (0.10.4)
19
19
  coderay (~> 1.1.0)
20
20
  method_source (~> 0.8.1)
21
21
  slop (~> 3.4)
22
- pry-byebug (3.4.0)
22
+ pry-byebug (3.4.2)
23
23
  byebug (~> 9.0)
24
24
  pry (~> 0.10)
25
25
  rake (11.3.0)
@@ -37,16 +37,17 @@ GEM
37
37
  rspec-support (~> 3.3.0)
38
38
  rspec-support (3.3.0)
39
39
  slop (3.6.0)
40
- thor (0.19.1)
40
+ thor (0.20.0)
41
41
 
42
42
  PLATFORMS
43
43
  ruby
44
44
 
45
45
  DEPENDENCIES
46
46
  appraisal
47
+ byebug (~> 9.0.6)
47
48
  pry-byebug
48
49
  rspec (~> 3.3.0)
49
50
  rspec-retry!
50
51
 
51
52
  BUNDLED WITH
52
- 1.14.6
53
+ 1.15.4
@@ -4,4 +4,4 @@ source "https://rubygems.org"
4
4
 
5
5
  gem "rspec", "~> 3.4.0"
6
6
 
7
- gemspec :path => "../"
7
+ gemspec path: "../"
@@ -1,28 +1,28 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rspec-retry (0.5.4)
4
+ rspec-retry (0.5.5)
5
5
  rspec-core (> 3.3, < 3.7)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- appraisal (2.1.0)
10
+ appraisal (2.2.0)
11
11
  bundler
12
12
  rake
13
13
  thor (>= 0.14.0)
14
14
  byebug (9.0.6)
15
15
  coderay (1.1.1)
16
- diff-lcs (1.2.5)
16
+ diff-lcs (1.3)
17
17
  method_source (0.8.2)
18
18
  pry (0.10.4)
19
19
  coderay (~> 1.1.0)
20
20
  method_source (~> 0.8.1)
21
21
  slop (~> 3.4)
22
- pry-byebug (3.4.0)
22
+ pry-byebug (3.4.2)
23
23
  byebug (~> 9.0)
24
24
  pry (~> 0.10)
25
- rake (11.3.0)
25
+ rake (12.0.0)
26
26
  rspec (3.4.0)
27
27
  rspec-core (~> 3.4.0)
28
28
  rspec-expectations (~> 3.4.0)
@@ -37,16 +37,17 @@ GEM
37
37
  rspec-support (~> 3.4.0)
38
38
  rspec-support (3.4.1)
39
39
  slop (3.6.0)
40
- thor (0.19.1)
40
+ thor (0.20.0)
41
41
 
42
42
  PLATFORMS
43
43
  ruby
44
44
 
45
45
  DEPENDENCIES
46
46
  appraisal
47
+ byebug (~> 9.0.6)
47
48
  pry-byebug
48
49
  rspec (~> 3.4.0)
49
50
  rspec-retry!
50
51
 
51
52
  BUNDLED WITH
52
- 1.14.6
53
+ 1.15.4
@@ -4,4 +4,4 @@ source "https://rubygems.org"
4
4
 
5
5
  gem "rspec", "~> 3.5.0"
6
6
 
7
- gemspec :path => "../"
7
+ gemspec path: "../"
@@ -1,28 +1,28 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rspec-retry (0.5.4)
4
+ rspec-retry (0.5.5)
5
5
  rspec-core (> 3.3, < 3.7)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- appraisal (2.1.0)
10
+ appraisal (2.2.0)
11
11
  bundler
12
12
  rake
13
13
  thor (>= 0.14.0)
14
14
  byebug (9.0.6)
15
15
  coderay (1.1.1)
16
- diff-lcs (1.2.5)
16
+ diff-lcs (1.3)
17
17
  method_source (0.8.2)
18
18
  pry (0.10.4)
19
19
  coderay (~> 1.1.0)
20
20
  method_source (~> 0.8.1)
21
21
  slop (~> 3.4)
22
- pry-byebug (3.4.0)
22
+ pry-byebug (3.4.2)
23
23
  byebug (~> 9.0)
24
24
  pry (~> 0.10)
25
- rake (11.3.0)
25
+ rake (12.0.0)
26
26
  rspec (3.5.0)
27
27
  rspec-core (~> 3.5.0)
28
28
  rspec-expectations (~> 3.5.0)
@@ -37,16 +37,17 @@ GEM
37
37
  rspec-support (~> 3.5.0)
38
38
  rspec-support (3.5.0)
39
39
  slop (3.6.0)
40
- thor (0.19.1)
40
+ thor (0.20.0)
41
41
 
42
42
  PLATFORMS
43
43
  ruby
44
44
 
45
45
  DEPENDENCIES
46
46
  appraisal
47
+ byebug (~> 9.0.6)
47
48
  pry-byebug
48
49
  rspec (~> 3.5.0)
49
50
  rspec-retry!
50
51
 
51
52
  BUNDLED WITH
52
- 1.14.6
53
+ 1.15.4
@@ -4,4 +4,4 @@ source "https://rubygems.org"
4
4
 
5
5
  gem "rspec", "~> 3.6.0"
6
6
 
7
- gemspec :path => "../"
7
+ gemspec path: "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- rspec-retry (0.5.4)
4
+ rspec-retry (0.5.5)
5
5
  rspec-core (> 3.3, < 3.7)
6
6
 
7
7
  GEM
@@ -37,16 +37,17 @@ GEM
37
37
  rspec-support (~> 3.6.0)
38
38
  rspec-support (3.6.0)
39
39
  slop (3.6.0)
40
- thor (0.19.4)
40
+ thor (0.20.0)
41
41
 
42
42
  PLATFORMS
43
43
  ruby
44
44
 
45
45
  DEPENDENCIES
46
46
  appraisal
47
+ byebug (~> 9.0.6)
47
48
  pry-byebug
48
49
  rspec (~> 3.6.0)
49
50
  rspec-retry!
50
51
 
51
52
  BUNDLED WITH
52
- 1.14.6
53
+ 1.15.4
@@ -26,6 +26,9 @@ module RSpec
26
26
  # If no list of exceptions is provided and 'retry' > 1, we always retry.
27
27
  config.add_setting :exceptions_to_retry, :default => []
28
28
 
29
+ # Callback between retries
30
+ config.add_setting :retry_callback, :default => nil
31
+
29
32
  config.around(:each) do |ex|
30
33
  ex.run_with_retry
31
34
  end
@@ -145,6 +148,11 @@ module RSpec
145
148
 
146
149
  example.example_group_instance.clear_lets if clear_lets
147
150
 
151
+ # If the callback is defined, let's call it
152
+ if RSpec.configuration.retry_callback
153
+ example.example_group_instance.instance_exec(example, &RSpec.configuration.retry_callback)
154
+ end
155
+
148
156
  sleep sleep_interval if sleep_interval.to_i > 0
149
157
  end
150
158
  end
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  class Retry
3
- VERSION = "0.5.4"
3
+ VERSION = "0.5.5"
4
4
  end
5
5
  end
@@ -7,6 +7,7 @@ Gem::Specification.new do |gem|
7
7
  gem.description = %q{retry intermittently failing rspec examples}
8
8
  gem.summary = %q{retry intermittently failing rspec examples}
9
9
  gem.homepage = "http://github.com/NoRedInk/rspec-retry"
10
+ gem.license = "MIT"
10
11
 
11
12
  gem.files = `git ls-files`.split($\)
12
13
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -17,9 +18,6 @@ Gem::Specification.new do |gem|
17
18
  gem.add_runtime_dependency(%{rspec-core}, '>3.3', '<3.7')
18
19
  gem.add_development_dependency %q{appraisal}
19
20
  gem.add_development_dependency %q{rspec}
20
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2')
21
- gem.add_development_dependency %q{pry-debugger}
22
- else
23
- gem.add_development_dependency %q{pry-byebug}
24
- end
21
+ gem.add_development_dependency %q{byebug}, '~>9.0.6' # 9.1 deprecates ruby 2.1
22
+ gem.add_development_dependency %q{pry-byebug}
25
23
  end
@@ -202,6 +202,54 @@ describe RSpec::Retry do
202
202
  end
203
203
  end
204
204
 
205
+ describe 'calling retry_callback between retries', retry: 2 do
206
+ before(:all) do
207
+ RSpec.configuration.retry_callback = proc do |example|
208
+ @retry_callback_called = true
209
+ @example = example
210
+ end
211
+ end
212
+
213
+ after(:all) do
214
+ RSpec.configuration.retry_callback = nil
215
+ end
216
+
217
+ context 'if failure' do
218
+ before(:all) do
219
+ @retry_callback_called = false
220
+ @example = nil
221
+ @retry_attempts = 0
222
+ end
223
+
224
+ it 'should call retry callback', with_some: 'metadata' do |example|
225
+ if @retry_attempts == 0
226
+ @retry_attempts += 1
227
+ expect(@retry_callback_called).to be(false)
228
+ expect(@example).to eq(nil)
229
+ raise "let's retry once!"
230
+ elsif @retry_attempts > 0
231
+ expect(@retry_callback_called).to be(true)
232
+ expect(@example).to eq(example)
233
+ expect(@example.metadata[:with_some]).to eq('metadata')
234
+ end
235
+ end
236
+ end
237
+
238
+ context 'does not call retry_callback if no errors' do
239
+ before(:all) do
240
+ @retry_callback_called = false
241
+ @example = nil
242
+ end
243
+
244
+ after do
245
+ expect(@retry_callback_called).to be(false)
246
+ expect(@example).to be_nil
247
+ end
248
+
249
+ it { true }
250
+ end
251
+ end
252
+
205
253
  describe 'output in verbose mode' do
206
254
 
207
255
  line_1 = __LINE__ + 8
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.5.4
4
+ version: 0.5.5
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: 2017-05-08 00:00:00.000000000 Z
12
+ date: 2017-08-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec-core
@@ -59,6 +59,20 @@ dependencies:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: byebug
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 9.0.6
69
+ type: :development
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 9.0.6
62
76
  - !ruby/object:Gem::Dependency
63
77
  name: pry-byebug
64
78
  requirement: !ruby/object:Gem::Requirement
@@ -105,7 +119,8 @@ files:
105
119
  - spec/lib/rspec/retry_spec.rb
106
120
  - spec/spec_helper.rb
107
121
  homepage: http://github.com/NoRedInk/rspec-retry
108
- licenses: []
122
+ licenses:
123
+ - MIT
109
124
  metadata: {}
110
125
  post_install_message:
111
126
  rdoc_options: []
@@ -123,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
138
  version: '0'
124
139
  requirements: []
125
140
  rubyforge_project:
126
- rubygems_version: 2.6.12
141
+ rubygems_version: 2.6.11
127
142
  signing_key:
128
143
  specification_version: 4
129
144
  summary: retry intermittently failing rspec examples