minitest-retry 0.1.8 → 0.1.9

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: dfdf6a4b4f0b3c08f50a3946aa85e8daa69dc3bc
4
- data.tar.gz: 4e3736d728990cc3776b65b2a095860a1b1fc20f
3
+ metadata.gz: ecca356b18b220ceac0b267626245edd50f7b343
4
+ data.tar.gz: 8fbc8b15e2b12c988c9a4855b2e13a2105db629d
5
5
  SHA512:
6
- metadata.gz: 7472580e97b64953d9c397cf8e0827fca1fc0879edde01cb7b2dc4c400a286e664f50f1255aca228ca333cee1d45a946c04f35758bb6f5b73e697ac2940746a6
7
- data.tar.gz: 30f020b54531ad76102d08ec91d2e631cf19ba2285c09a3b23de7c391c2b2a95063b11f1b9ec735a0970948298e001e8579e21b7ed24e789b18dbd166ff7d235
6
+ metadata.gz: 170bc39e8133e8e6099467d2689fc96d17bf50faa1adbd95bc4044d4537562041dbe3570972e579106ea3506504b626c3a85dde7343915c63797a8f734799111
7
+ data.tar.gz: d89bdfaf9cddecd3ec8e426bc8fdcd2409bcdbe5162fb993ad269be8a02a405b6bfdc4f3b22d5c3838498c699caa295466f60d18523ebcfd2eb12dc0996508cb
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.1
4
- - 2.2.6
5
- - 2.3.3
6
- - 2.4.0
4
+ - 2.2.7
5
+ - 2.3.4
6
+ - 2.4.1
7
7
  before_install: gem install bundler
@@ -1,3 +1,7 @@
1
+ ## 0.1.9
2
+
3
+ * Add on_consistent_failure callback #20 [staugaard]
4
+
1
5
  ## 0.1.8
2
6
 
3
7
  * Add retry callback #17 [julien-meichelbeck]
data/README.md CHANGED
@@ -49,13 +49,19 @@ Minitest::Retry.on_failure do |klass, test_name|
49
49
  end
50
50
  ```
51
51
 
52
+ The `on_consistent_failure` callback is executed whan a test consistently fails:
53
+ ```ruby
54
+ Minitest::Retry.on_consistent_failure do |klass, test_name|
55
+ # code omitted
56
+ end
57
+ ```
58
+
52
59
  The `on_retry` callback is executed each time a test is retried:
53
60
  ```ruby
54
61
  Minitest::Retry.on_retry do |klass, test_name, retry_count|
55
62
  # code omitted
56
63
  end
57
-
58
-
64
+ ```
59
65
 
60
66
  ## Example
61
67
 
@@ -5,7 +5,7 @@ module Minitest
5
5
  class << self
6
6
  def use!(retry_count: 3, io: $stdout, verbose: true, exceptions_to_retry: [])
7
7
  @retry_count, @io, @verbose, @exceptions_to_retry = retry_count, io, verbose, exceptions_to_retry
8
- @failure_callback, @retry_callback = nil, nil
8
+ @failure_callback, @consistent_failure_callback, @retry_callback = nil, nil, nil
9
9
  Minitest.prepend(self)
10
10
  end
11
11
 
@@ -14,6 +14,11 @@ module Minitest
14
14
  @failure_callback = block
15
15
  end
16
16
 
17
+ def on_consistent_failure(&block)
18
+ return unless block_given?
19
+ @consistent_failure_callback = block
20
+ end
21
+
17
22
  def on_retry(&block)
18
23
  return unless block_given?
19
24
  @retry_callback = block
@@ -39,6 +44,10 @@ module Minitest
39
44
  @failure_callback
40
45
  end
41
46
 
47
+ def consistent_failure_callback
48
+ @consistent_failure_callback
49
+ end
50
+
42
51
  def retry_callback
43
52
  @retry_callback
44
53
  end
@@ -68,6 +77,10 @@ module Minitest
68
77
  result = super(klass, method_name)
69
78
  break if result.failures.empty?
70
79
  end
80
+
81
+ if Minitest::Retry.consistent_failure_callback && !result.failures.empty?
82
+ Minitest::Retry.consistent_failure_callback.call(klass, method_name)
83
+ end
71
84
  end
72
85
  result
73
86
  end
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Retry
3
- VERSION = "0.1.8"
3
+ VERSION = "0.1.9"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-retry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Yaginuma
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-07 00:00:00.000000000 Z
11
+ date: 2017-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  requirements: []
94
94
  rubyforge_project:
95
- rubygems_version: 2.6.8
95
+ rubygems_version: 2.6.12
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: re-run the test when the test fails