minitest-retry 0.1.5 → 0.1.6

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: c97a4d9d325dfeda51a53320920286a3cd8e4405
4
- data.tar.gz: fa4a3377622269b62cfaf46974c5be49e10406df
3
+ metadata.gz: 48f8d8974ffc3f3099a0edbbc4c7b3e6124c3084
4
+ data.tar.gz: a629409c0946a5c05bea0e24be1d8287ff7bbe32
5
5
  SHA512:
6
- metadata.gz: e4f92acdbe869fbf1769a3b5bdd60004bf8f8f566f7b8e2615acda895775365f90ef71a1fe38580d00905c0e7d5a49b422d6b1d88ed701ccdffa5c1e8ab9054f
7
- data.tar.gz: 72bebddc87acc65bf81bbe22d21443d8fbbc766d4d10913f3f21b258855304de5468e746146b7b84fa92d42599adeea34ff0f2bae1d64577c3344fcd0354ac53
6
+ metadata.gz: d8d3c814c37a137be4269cf092a4a363dcdd82597c563e127e948b8631c26804787f8c5bd2c4524707f154f499901f4ff01b8dbfc72acc42af5a5cfc830698d7
7
+ data.tar.gz: 8bd918699dbb207c4f100e98a8f508fb0b9f789ac4e2bf1d1b06331a552a0145edbdebe731fcf7545527a5a772a12edbed1ef801ff355b82348c3a01e5bf918d
@@ -1,6 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.1
4
- - 2.2
5
- - 2.3.0
6
- before_install: gem install bundler -v 1.10.4
4
+ - 2.2.6
5
+ - 2.3.3
6
+ - 2.4.0-preview3
7
+ before_install: gem install bundler
@@ -1,10 +1,14 @@
1
+ ## 0.1.6
2
+
3
+ * Add exceptions_to_retry option #13 [panjan]
4
+
1
5
  ## 0.1.5
2
6
 
3
- * Improve message information when an unexpected error occurs [abarre]
7
+ * Improve message information when an unexpected error occurs #9 [abarre]
4
8
 
5
9
  ## 0.1.4
6
10
 
7
- * Fix typo in verbose output [semanticart]
11
+ * Fix typo in verbose output #6 [semanticart]
8
12
 
9
13
  ## 0.1.3
10
14
 
data/README.md CHANGED
@@ -34,9 +34,10 @@ Options can be specified to `use!` method. Can specify options are as follows:
34
34
 
35
35
  ```ruby
36
36
  Minitest::Retry.use!(
37
- retry_count: 3 # The number of times to retry. The default is 3.
38
- verbose: true # Whether or not to display the message at the time of retry. The default is true.
39
- io: $stdout # Display destination of retry when the message. The default is stdout.
37
+ retry_count: 3, # The number of times to retry. The default is 3.
38
+ verbose: true, # Whether or not to display the message at the time of retry. The default is true.
39
+ io: $stdout, # Display destination of retry when the message. The default is stdout.
40
+ exceptions_to_retry: [] # List of exceptions that will trigger a retry (when empty, all exceptions will).
40
41
  )
41
42
  ```
42
43
 
@@ -2,8 +2,8 @@ require "minitest/retry/version"
2
2
 
3
3
  module Minitest
4
4
  module Retry
5
- def self.use!(retry_count: 3, io: $stdout, verbose: true)
6
- @retry_count, @io, @verbose = retry_count, io, verbose
5
+ def self.use!(retry_count: 3, io: $stdout, verbose: true, exceptions_to_retry: [])
6
+ @retry_count, @io, @verbose, @exceptions_to_retry = retry_count, io, verbose, exceptions_to_retry
7
7
  Minitest.prepend(self)
8
8
  end
9
9
 
@@ -19,11 +19,23 @@ module Minitest
19
19
  @verbose
20
20
  end
21
21
 
22
+ def self.exceptions_to_retry
23
+ @exceptions_to_retry
24
+ end
25
+
26
+ def self.failure_to_retry?(failures = [])
27
+ return false if failures.empty?
28
+ return true if Minitest::Retry.exceptions_to_retry.empty?
29
+ errors = failures.map(&:error).map(&:class)
30
+ (errors & Minitest::Retry.exceptions_to_retry).any?
31
+ end
32
+
22
33
  module ClassMethods
23
34
  def run_one_method(klass, method_name)
24
35
  retry_count = Minitest::Retry.retry_count
25
36
  result = super(klass, method_name)
26
- if !result.failures.empty? && !result.skipped?
37
+ return result unless Minitest::Retry.failure_to_retry?(result.failures)
38
+ if !result.skipped?
27
39
  retry_count.times do |count|
28
40
  if Minitest::Retry.verbose && Minitest::Retry.io
29
41
  msg = "[MinitestRetry] retry '%s' count: %s, msg: %s\n" %
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Retry
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
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.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Yaginuma
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-17 00:00:00.000000000 Z
11
+ date: 2016-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest