rspec-retry-flaky 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +16 -0
- data/README.md +28 -4
- data/lib/rspec/flaky/version.rb +1 -1
- data/lib/rspec/retry_flaky.rb +5 -0
- data/rspec-retry-flaky.gemspec +4 -2
- data/spec/lib/rspec/retry_flaky_spec.rb +11 -5
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15ef2b9e60343c399af3125be74b60d0139ad148
|
4
|
+
data.tar.gz: 6327509a69580d562fdc40053480dbd506d06298
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d092d0960a33c5770b5379b7c7229fe87318c855f34068c9d9090497e09f5d1b6eb94738295bb0cc16b69caf45055f692637630713edf57f5907bcdd4d4ed99a
|
7
|
+
data.tar.gz: 97d912cc161ee892ebdd99d1347e5a95d3f7b7ec6b50660ea88abaf8d2716b558b8f16dcbcb858f308e547905d6ebcfe9eeb2562b4b4092bfe53bb32c8a5d7c8
|
data/.travis.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
rvm:
|
4
|
+
- 2.0.0
|
5
|
+
- 2.1.0
|
6
|
+
- 2.1.4
|
7
|
+
|
8
|
+
script: bundle exec rspec
|
9
|
+
|
10
|
+
branches:
|
11
|
+
only:
|
12
|
+
- master
|
13
|
+
|
14
|
+
notifications:
|
15
|
+
slack:
|
16
|
+
secure: dREoGm6W0qj17FsaUOGk05/+hdzfIti5UNDVGqD+CoUUigElOJuY9TG9udH+aKp75ILtZ4gsnxFac9KxvTrMfMU+tYeuwfE7dZiApNz0e3G1gRYcbNym6z/z4GLR1F8or6XcHPmKwor5qJ/3e+u9ZbiqT3s4cgU4dFJN8xXxpms=
|
data/README.md
CHANGED
@@ -1,13 +1,19 @@
|
|
1
|
-
#
|
1
|
+
# RspecRetryFlaky
|
2
2
|
|
3
|
-
|
3
|
+
Retry rspec if failed some tests.
|
4
|
+
|
5
|
+
You can set how many retry test and how long wait retrying test within RSpec.configure.
|
6
|
+
|
7
|
+
## Build Status
|
8
|
+
|
9
|
+
[![Build Status](https://travis-ci.org/KazuCocoa/rspec-retry-flaky.svg?branch=master)](https://travis-ci.org/KazuCocoa/rspec-retry-flaky)
|
4
10
|
|
5
11
|
## Installation
|
6
12
|
|
7
13
|
Add this line to your application's Gemfile:
|
8
14
|
|
9
15
|
```ruby
|
10
|
-
gem '
|
16
|
+
gem 'rspec-retry-flaky'
|
11
17
|
```
|
12
18
|
|
13
19
|
And then execute:
|
@@ -16,7 +22,7 @@ And then execute:
|
|
16
22
|
|
17
23
|
Or install it yourself as:
|
18
24
|
|
19
|
-
$ gem install
|
25
|
+
$ gem install rspec-retry-flaky
|
20
26
|
|
21
27
|
require in ```rspec_helper.rb```
|
22
28
|
|
@@ -32,6 +38,24 @@ This feature use ```RSpec.configure.around(:example) { |example| something }```
|
|
32
38
|
|
33
39
|
## Usage
|
34
40
|
|
41
|
+
### Turn off flaky retry
|
42
|
+
|
43
|
+
```
|
44
|
+
it "example scenario", :off_flaky_test do
|
45
|
+
# test case
|
46
|
+
end
|
47
|
+
```
|
48
|
+
|
49
|
+
It can use in Turnip.
|
50
|
+
|
51
|
+
```
|
52
|
+
@off_flaky_test
|
53
|
+
Feature: example
|
54
|
+
Scenario: attack the monster
|
55
|
+
When I attack it
|
56
|
+
Then it should die
|
57
|
+
```
|
58
|
+
|
35
59
|
### progress message when the example retry
|
36
60
|
|
37
61
|
```
|
data/lib/rspec/flaky/version.rb
CHANGED
data/lib/rspec/retry_flaky.rb
CHANGED
@@ -14,6 +14,11 @@ module RSpec
|
|
14
14
|
retry_count = RSpec.configuration.flaky_retry_count
|
15
15
|
sleep_interval = RSpec.configuration.flaky_sleep_interval
|
16
16
|
|
17
|
+
if example.metadata[:off_flaky_test]
|
18
|
+
RSpec.configuration.reporter.message "\nTurn retry flaky off: #{example.location}"
|
19
|
+
retry_count = 1 # make retry_count default
|
20
|
+
end
|
21
|
+
|
17
22
|
retry_count.times do |r_count|
|
18
23
|
if RSpec.configuration.verbose_retry_flaky_example && r_count > 0
|
19
24
|
msg = "\nRetry flaky #{r_count} times: #{example.location}"
|
data/rspec-retry-flaky.gemspec
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
require_relative 'lib/rspec/flaky/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
+
spec.required_ruby_version = '>= 2.0.0'
|
7
|
+
|
6
8
|
spec.name = 'rspec-retry-flaky'
|
7
9
|
spec.version = RSpec::Flaky::VERSION
|
8
10
|
spec.authors = ['Kazuaki MATSUO']
|
@@ -17,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
17
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
20
|
spec.require_paths = ['lib']
|
19
21
|
|
20
|
-
spec.add_runtime_dependency 'rspec', '>= 3', '< 4'
|
22
|
+
spec.add_runtime_dependency 'rspec', '>= 3.0', '< 4'
|
21
23
|
|
22
|
-
spec.add_development_dependency
|
24
|
+
spec.add_development_dependency 'guard-rspec'
|
23
25
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'stringio'
|
2
3
|
|
3
4
|
describe RSpec::Flaky do
|
4
5
|
|
@@ -46,18 +47,24 @@ describe RSpec::Flaky do
|
|
46
47
|
# raise error at rspec-expectations-3.1.2/lib/rspec/expectations/fail_with.rb:30:in `fail_with'
|
47
48
|
# But count and expectations are expected.
|
48
49
|
# TODO Should make stable.
|
49
|
-
=begin
|
50
50
|
context 'with retry count' do
|
51
|
-
let
|
51
|
+
let(:retry_count) { 3 }
|
52
52
|
before(:all) { RSpec.configure { |c| c.flaky_retry_count = 3 } }
|
53
53
|
before(:each) { count_up }
|
54
54
|
|
55
|
+
# TODO Should fail at first time.
|
56
|
+
context do
|
57
|
+
it "set flaky_retry_count is #{:retry_count}, but set no_flaky_test tag", :off_flaky_test do
|
58
|
+
expect(count).to eq 1
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
=begin
|
55
63
|
context do
|
56
64
|
before(:all) { set_expectations([false, false, true]) }
|
57
65
|
|
58
66
|
it "should run example until #{:retry_count} times" do
|
59
67
|
expect(true).to be @expectations[count - 1]
|
60
|
-
puts "======#{count}======="
|
61
68
|
expect(count).to eq 3
|
62
69
|
end
|
63
70
|
|
@@ -68,11 +75,10 @@ describe RSpec::Flaky do
|
|
68
75
|
|
69
76
|
it "should stop example if example succeed" do
|
70
77
|
expect(true).to be @expectations[count - 1]
|
71
|
-
puts "======#{count}======="
|
72
78
|
expect(count).to eq 2
|
73
79
|
end
|
74
80
|
end
|
75
|
-
end
|
76
81
|
=end
|
77
82
|
|
83
|
+
end
|
78
84
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-retry-flaky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuaki MATSUO
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3'
|
19
|
+
version: '3.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '4'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '3'
|
29
|
+
version: '3.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '4'
|
@@ -52,6 +52,7 @@ extensions: []
|
|
52
52
|
extra_rdoc_files: []
|
53
53
|
files:
|
54
54
|
- ".gitignore"
|
55
|
+
- ".travis.yml"
|
55
56
|
- Gemfile
|
56
57
|
- LICENSE.txt
|
57
58
|
- README.md
|
@@ -74,7 +75,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
75
|
requirements:
|
75
76
|
- - ">="
|
76
77
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
78
|
+
version: 2.0.0
|
78
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
80
|
requirements:
|
80
81
|
- - ">="
|