rspec-retry-flaky 0.0.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f11755d5c7a4cced8eecd10aa3abfeb952e7d262
4
+ data.tar.gz: 5a2f26c0b2bd7db422b019c287915fd122a452ea
5
+ SHA512:
6
+ metadata.gz: 2d4114e7454ae766b9e906d2c0e98913b158afba13023738c66a3b4d7d0246d02c748b2c5e7c5062c1e63a930c04b57440b191d2d013136cc82a2ab5bc69373a
7
+ data.tar.gz: ce380120e4db12ed4e888cf5b3fc6c9179bd262a28c83383b16d9fcc7e00d742f7d79cdecbf362e55eebabc8f76aabddd0547476e3ce20fc9a5528fb3f1b0875
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ .idea
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rspec-retry-flaky.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Kazuaki MATSUO
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # RetryFlakyExample
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'retry_flaky_example'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install retry_flaky_example
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/retry_flaky_example/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,5 @@
1
+ module RSpec
2
+ class Flaky
3
+ VERSION = '0.0.2'
4
+ end
5
+ end
@@ -0,0 +1,38 @@
1
+ require 'rspec/core'
2
+ require 'rspec/flaky/version'
3
+ require 'rspec_ext/rspec_ext'
4
+
5
+ module RSpec
6
+ class Flaky
7
+ def self.apply
8
+ RSpec.configure do |conf|
9
+ conf.add_setting :verbose_retry_flack_example, :default => false
10
+ conf.add_setting :flaky_retry_count, :default => 1
11
+ conf.add_setting :flaky_sleep_interval, :default => 0
12
+
13
+ conf.around(:example) do |example|
14
+ retry_count = RSpec.configuration.flaky_retry_count
15
+ sleep_interval = RSpec.configuration.flaky_sleep_interval
16
+
17
+ retry_count.times do |r_count|
18
+ if RSpec.configuration.verbose_retry_flack_example && r_count > 0
19
+ msg = "Retry flaky #{r_count} times: #{example.location}"
20
+ RSpec.configuration.reporter.message msg
21
+ end
22
+
23
+ example.clear_exception
24
+ example.run
25
+
26
+ break if example.exception.nil?
27
+
28
+ sleep sleep_interval if sleep_interval.to_i > 0
29
+
30
+ end
31
+
32
+ end # conf.around
33
+ end # RSpec.configure
34
+ end # def self.apply
35
+ end # class Flaky
36
+ end # module RSpec
37
+
38
+ RSpec::Flaky.apply
@@ -0,0 +1,11 @@
1
+ module RSpec
2
+ module Core
3
+ class Example
4
+ class Procsy
5
+ def clear_exception
6
+ @exception = nil
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+
3
+ require_relative 'lib/rspec/flaky/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'rspec-retry-flaky'
7
+ spec.version = RSpec::Flaky::VERSION
8
+ spec.authors = ['Kazuaki MATSUO']
9
+ spec.email = ['fly.49.89.over@gmail.com']
10
+ spec.summary = %q{retry failed flaky example}
11
+ spec.description = %q{retry failed flaky example}
12
+ spec.homepage = 'https://github.com/KazuCocoa/rspec-retry-flaky'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.add_runtime_dependency 'rspec', '~> 3.0.0', '< 4'
21
+
22
+ spec.add_development_dependency %q{guard-rspec}
23
+ end
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ describe RSpec::Flaky do
4
+
5
+ def count
6
+ @count ||= 0
7
+ @count
8
+ end
9
+
10
+ def count_up
11
+ @count ||= 0
12
+ @count += 1
13
+ end
14
+
15
+ def set_expectations(expectations)
16
+ @expectations = expectations
17
+ end
18
+
19
+ def shift_expectation
20
+ @expectations.shift
21
+ end
22
+
23
+ context 'no retry option' do
24
+ it 'should work' do
25
+ expect(true).to be true
26
+ end
27
+ end
28
+
29
+ context 'with retry_flaky option' do
30
+ let(:retry_count) { 3 }
31
+ let(:sleep_interval) { 10 }
32
+
33
+ it 'default flaky_retry_count is 1' do
34
+ expect(RSpec.configuration.flaky_retry_count).to eq 1
35
+ end
36
+ it "set flaky_retry_count is #{:retry_count}" do
37
+ RSpec.configure { |c| c.flaky_retry_count = retry_count }
38
+ expect(RSpec.configuration.flaky_retry_count).to eq retry_count
39
+ end
40
+
41
+ it 'default flaky_sleep_interval is 0' do
42
+ expect(RSpec.configuration.flaky_sleep_interval).to eq 0
43
+ end
44
+ it "set flaky_sleep_interval is #{:sleep_interval}" do
45
+ RSpec.configure { |c| c.flaky_sleep_interval = sleep_interval }
46
+ expect(RSpec.configuration.flaky_sleep_interval).to eq sleep_interval
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,6 @@
1
+ require 'rspec'
2
+ require 'rspec/retry_flaky'
3
+
4
+ RSpec.configure do |c|
5
+ c.verbose_retry_flack_example = true
6
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-retry-flaky
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Kazuaki MATSUO
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 3.0.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '4'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: 3.0.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '4'
33
+ - !ruby/object:Gem::Dependency
34
+ name: guard-rspec
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ description: retry failed flaky example
48
+ email:
49
+ - fly.49.89.over@gmail.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - ".gitignore"
55
+ - Gemfile
56
+ - LICENSE.txt
57
+ - README.md
58
+ - Rakefile
59
+ - lib/rspec/flaky/version.rb
60
+ - lib/rspec/retry_flaky.rb
61
+ - lib/rspec_ext/rspec_ext.rb
62
+ - rspec-retry-flaky.gemspec
63
+ - spec/lib/rspec/retry_flaky_spec.rb
64
+ - spec/spec_helper.rb
65
+ homepage: https://github.com/KazuCocoa/rspec-retry-flaky
66
+ licenses:
67
+ - MIT
68
+ metadata: {}
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubyforge_project:
85
+ rubygems_version: 2.2.2
86
+ signing_key:
87
+ specification_version: 4
88
+ summary: retry failed flaky example
89
+ test_files:
90
+ - spec/lib/rspec/retry_flaky_spec.rb
91
+ - spec/spec_helper.rb