rspec-retry-flaky 0.1.1 → 0.2.0

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: a2ef6f65aef984b9e4170f6e39f628dd85b0d42d
4
- data.tar.gz: 020d3a453b1bb1687395e570e3513a9d87597dc7
3
+ metadata.gz: 15ef2b9e60343c399af3125be74b60d0139ad148
4
+ data.tar.gz: 6327509a69580d562fdc40053480dbd506d06298
5
5
  SHA512:
6
- metadata.gz: 75b35eb98b1c046a53a38b1602a90a0018433f3b8bcfdc39a82267068ec1705c325e2cc8163407bc09cd497103f709959653b5734383ad32168b184be4c1e7a3
7
- data.tar.gz: 1a5fb06abdd705cdcb114cc6a111dd0a2cf52be84a75fa31247b430fdd87ca3f9ed2a1894ce5460be479b85f2e98f126a4d6ed4f3b6207dddab9b75daab05430
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
- # RetryFlakyExample
1
+ # RspecRetryFlaky
2
2
 
3
- TODO: Write a gem description
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 'retry_flaky_example'
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 retry_flaky_example
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
  ```
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  class Flaky
3
- VERSION = '0.1.1'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
@@ -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}"
@@ -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 %q{guard-rspec}
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!(:retry_count) { 3 }
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.1.1
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: '0'
78
+ version: 2.0.0
78
79
  required_rubygems_version: !ruby/object:Gem::Requirement
79
80
  requirements:
80
81
  - - ">="