rspec-repeat 1.0.1 → 1.0.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: 5f07fba04acb88fd2eaf370bfe12147ffb64a5c1
4
- data.tar.gz: f8dacce2acc34b8b8114c518077e3203e4fb0579
3
+ metadata.gz: 59d577d9272c369c5c1619fc93dedd5e4df187cd
4
+ data.tar.gz: 36e055e49a981acfa79ea392624b1c0d566bdc5d
5
5
  SHA512:
6
- metadata.gz: 0d69bb0efe449044f7aeb62936d289f0eec33a2cac8570484eb48483bfdc2610175310e9dd3badd5edcedb57feaea3544b6b0be80db492b11b2e868ae1e59339
7
- data.tar.gz: 977fb7e8a6478b352040277329a3397c3ea16b5a05887aebdf274822f778f00cfbc0b1dbd6e4028ce2d4c86b3fbc604b905b18097d892efaf385570221e22c04
6
+ metadata.gz: dc5010cff6d26c3a369ad7cd39b231dac2fabf5a9ccfcb398c17f3d08f66cab594273563ea4a3ac641dd00ca040bd28bfbd6aa13056823bd45196eadd1496c33
7
+ data.tar.gz: ffe2c0ccf93974766c68bd779ee991da80e7e73ec7c7815f25582fd61469c809d883ac9758a8e601ec7c53cdfa831fb39444311023fc7145a16adf888b60d76e
data/HISTORY.md CHANGED
@@ -1,4 +1,11 @@
1
- # v1.0.1
1
+ ## [v1.0.2]
2
+ > Sep 25, 2015
3
+
4
+ - Fix `:exceptions` option.
5
+
6
+ [v1.0.2]: https://github.com/rstacruz/rspec-repeat/compare/v1.0.1...v1.0.2
7
+
8
+ ## v1.0.1
2
9
  > Sep 25, 2015
3
10
 
4
11
  - Initial release.
data/README.md CHANGED
@@ -7,10 +7,10 @@ describe 'a stubborn test' do
7
7
  include Rspec::Repeat
8
8
 
9
9
  around do |example|
10
- repeat example, 3.times
10
+ repeat example, 10.times
11
11
  end
12
12
 
13
- it 'works' do
13
+ it 'works, eventually' do
14
14
  expect(rand(2)).to eq 0
15
15
  end
16
16
  end
@@ -22,9 +22,22 @@ end
22
22
 
23
23
  ## Advanced usage
24
24
 
25
+ ### Options
26
+
27
+ ```
28
+ repeat example, 3.times, { options }
29
+ ```
30
+
31
+ You can pass an `options` hash:
32
+
33
+ - __clear_let__ *(Boolean)* - if *false*, `let` declarations will not be cleared.
34
+ - __exceptions__ *(Array)* - if given, it will only retry exception classes from this list.
35
+ - __wait__ *(Numeric)* - seconds to wait between each retry.
36
+ - __verbose__ *(Boolean)* - if *true*, it will print messages upon failure.
37
+
25
38
  ### Attaching to tags
26
39
 
27
- This will allow you to repeat any example thrice by tagging it.
40
+ This will allow you to repeat any example multiple times by tagging it.
28
41
 
29
42
  ```rb
30
43
  # rails_helper.rb or spec_helper.rb
@@ -43,7 +56,7 @@ end
43
56
 
44
57
  ### Attaching to features
45
58
 
46
- This will make all `spec/features/` retry thrice. Perfect for stubborn Poltergeist/Selenium tests.
59
+ This will make all `spec/features/` retry thrice. Perfect for Poltergeist/Selenium tests that intermittently fail for no reason.
47
60
 
48
61
  ```rb
49
62
  # rails_helper.rb or spec_helper.rb
@@ -54,6 +67,12 @@ RSpec.configure do
54
67
  end
55
68
  ```
56
69
 
70
+ In these cases, it'd be smart to restrict which exceptions to be retried.
71
+
72
+ ```rb
73
+ repeat example, 3.times, exceptions: [ Net::ReadTimeout ]
74
+ ```
75
+
57
76
  <br>
58
77
 
59
78
  ## Acknowledgement
@@ -45,7 +45,7 @@ module RSpec
45
45
  example.instance_variable_set :@exception, nil
46
46
  ex.run
47
47
  break if example.exception.nil?
48
- break if matches_exceptions?(exceptions, example.exception)
48
+ break if !matches_exceptions?(exceptions, example.exception)
49
49
  print_failure(i, example) if verbose
50
50
  clear_memoize(ctx) if clear_let
51
51
  sleep wait if wait.to_i > 0
@@ -72,7 +72,7 @@ module RSpec
72
72
 
73
73
  # Checks if `exception` is in `exceptions`
74
74
  def matches_exceptions?(exceptions, exception)
75
- return unless exceptions
75
+ return true unless exceptions
76
76
  exceptions.any? do |exception_klass|
77
77
  exception.is_a?(exception_klass)
78
78
  end
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module Repeat
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-repeat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rico Sta. Cruz