https://github.com/noredink/rspec-retry
retry randomly failing rspec example
https://github.com/noredink/rspec-retry
Keywords from Contributors
activerecord activejob mvc rspec rubygems crash-reporting static-code-analysis code-formatter rubocop ruby-gem
Last synced: about 22 hours ago
JSON representation
Repository metadata
retry randomly failing rspec example
- Host: GitHub
- URL: https://github.com/noredink/rspec-retry
- Owner: NoRedInk
- License: mit
- Archived: true
- Created: 2012-07-21T06:59:52.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2023-11-24T07:45:40.000Z (over 2 years ago)
- Last Synced: 2026-02-26T13:04:18.967Z (5 days ago)
- Language: Ruby
- Size: 159 KB
- Stars: 594
- Watchers: 17
- Forks: 102
- Open Issues: 33
- Releases: 2
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
- License: LICENSE
README.md
RSpec::Retry 
RSpec::Retry adds a :retry option for intermittently failing rspec examples.
If an example has the :retry option, rspec will retry the example the
specified number of times until the example succeeds.
Compatibility
| Rspec Version | Rspec-Retry Version |
|---|---|
| > 3.8 | 0.6.2 but untested |
| > 3.3, <= 3.8 | 0.6.2 |
| 3.2 | 0.4.6 |
| 2.14.8 | 0.4.4 |
Maintenance Expectations
NoRedInk used to be a Ruby shop, and we open-sourced this in the hope that it will help other people.
However, we've been moving away from Ruby for some time now, and only plan to do maintenance on this repo when we have an internal need for it.
We don't plan to add any new functionality, and expect that it will fall behind the latest versions of Ruby and Rspec.
That said, if you're reading this and you need this gem to do something new, feel free to fork it and publish your own gem!
If you open an issue here to let us know about your fork, we can add a link to it from this repo to help folks find something that's more actively maintained.
Installation
Add this line to your application's Gemfile:
gem 'rspec-retry', group: :test # Unlike rspec, this doesn't need to be included in development group
And then execute:
$ bundle
Or install it yourself as:
$ gem install rspec-retry
require in spec_helper.rb
# spec/spec_helper.rb
require 'rspec/retry'
RSpec.configure do |config|
# show retry status in spec process
config.verbose_retry = true
# show exception that triggers a retry if verbose_retry is set to true
config.display_try_failure_messages = true
# run retry only on features
config.around :each, :js do |ex|
ex.run_with_retry retry: 3
end
# callback to be run between retries
config.retry_callback = proc do |ex|
# run some additional clean up task - can be filtered by example metadata
if ex.metadata[:js]
Capybara.reset!
end
end
end
Usage
it 'should randomly succeed', :retry => 3 do
expect(rand(2)).to eq(1)
end
it 'should succeed after a while', :retry => 3, :retry_wait => 10 do
expect(command('service myservice status')).to eq('started')
end
# run spec (following log is shown if verbose_retry options is true)
# RSpec::Retry: 2nd try ./spec/lib/random_spec.rb:49
# RSpec::Retry: 3rd try ./spec/lib/random_spec.rb:49
Calling run_with_retry programmatically
You can call ex.run_with_retry(opts) on an individual example.
Configuration
- :verbose_retry(default: false) Print retry status
- :display_try_failure_messages (default: false) If verbose retry is enabled, print what reason forced the retry
- :default_retry_count(default: 1) If retry count is not set in an example, this value is used by default. Note that currently this is a 'try' count. If increased from the default of 1, all examples will be retried. We plan to fix this as a breaking change in version 1.0.
- :default_sleep_interval(default: 0) Seconds to wait between retries
- :clear_lets_on_failure(default: true) Clear memoized values for
lets before retrying - :exceptions_to_hard_fail(default: []) List of exceptions that will trigger an immediate test failure without retry. Takes precedence over :exceptions_to_retry
- :exceptions_to_retry(default: []) List of exceptions that will trigger a retry (when empty, all exceptions will)
- :retry_callback(default: nil) Callback function to be called between retries
Environment Variables
- RSPEC_RETRY_RETRY_COUNT can override the retry counts even if a retry count is set in an example or default_retry_count is set in a configuration.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Added some feature') - Push to the branch (
git push origin my-new-feature) - Create a pull request
Owner metadata
- Name: NoRedInk
- Login: NoRedInk
- Email: eng@noredink.com
- Kind: organization
- Description: We teach writing!
- Website: https://www.noredink.com/
- Location: San Francisco, CA
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/1747062?v=4
- Repositories: 210
- Last ynced at: 2024-04-14T19:16:32.561Z
- Profile URL: https://github.com/NoRedInk
GitHub Events
Total
- Pull request event: 1
- Fork event: 6
- Issues event: 1
- Watch event: 13
- Issue comment event: 5
Last Year
- Fork event: 2
- Issues event: 1
- Watch event: 8
- Issue comment event: 5
Committers metadata
Last synced: 1 day ago
Total Commits: 124
Total Committers: 37
Avg Commits per committer: 3.351
Development Distribution Score (DDS): 0.621
Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| Michael Glass | me@m****s | 47 |
| Yusuke Mito | y****4@g****m | 10 |
| David Butler | d****r@u****u | 5 |
| Dane Thorsen | d****n | 5 |
| Jon Rowe | h****o@j****k | 4 |
| Eito Katagiri | e****l@g****m | 4 |
| Yusuke Mito | y****o@c****m | 4 |
| Adam Eberlin | a****n@o****m | 4 |
| Socrates Vicente | s****e@n****m | 3 |
| Hagai | h****i@b****o | 3 |
| Patrick Veith | p****k@j****m | 2 |
| Thierry DEO | t****o@g****m | 2 |
| Anthony Woo | a****8@g****m | 2 |
| Brian Hicks | b****n@b****m | 2 |
| Justin Gordon | j****n@g****m | 2 |
| Olle Jonsson | o****n@g****m | 2 |
| Pete Hodgson | g****t@t****t | 2 |
| sunflat | g****t@s****t | 2 |
| Akinori MUSHA | k****u@i****g | 1 |
| yuuji.yaginuma | y****a@g****m | 1 |
| hkariti | h****i@g****m | 1 |
| Yasyf Mohamedali | y****m@g****m | 1 |
| Trevor Creech | t****r@t****m | 1 |
| Dane Thorsen | d****n@g****m | 1 |
| Dylan Reile | d****e@g****m | 1 |
| Stefan Wrobel | s****l | 1 |
| Ryan Oglesby | r****8@g****m | 1 |
| Robert Reiz | r****b@v****m | 1 |
| Oleh Khomey | v****m@g****m | 1 |
| Oleg Pudeyev | o****g@b****m | 1 |
| and 7 more... | ||
Committer domains:
- dio.jp: 1
- amazon.com: 1
- morast.org: 1
- bsdpower.com: 1
- versioneye.com: 1
- gannett.com: 1
- trevorcreech.com: 1
- idaemons.org: 1
- sunflat.net: 1
- thepete.net: 1
- brianthicks.com: 1
- joinroot.com: 1
- bigpanda.io: 1
- notonthehighstreet.com: 1
- opploans.com: 1
- cookpad.com: 1
- jonrowe.co.uk: 1
- ucla.edu: 1
- mike.is: 1
Issue and Pull Request metadata
Last synced: about 1 month ago
Total issues: 54
Total pull requests: 50
Average time to close issues: 5 months
Average time to close pull requests: 4 months
Total issue authors: 45
Total pull request authors: 35
Average comments per issue: 2.94
Average comments per pull request: 2.0
Merged pull request: 33
Bot issues: 0
Bot pull requests: 0
Past year issues: 1
Past year pull requests: 1
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 1
Past year pull request authors: 1
Past year average comments per issue: 2.0
Past year average comments per pull request: 0.0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- michaelglass (7)
- uscengineer (2)
- csalvato (2)
- crawfoal (2)
- oehlschl (1)
- leehambley (1)
- aguynamedben (1)
- tansaku (1)
- swaroopmurthy (1)
- matt-murdock (1)
- CharlesMcMillan (1)
- jagthedrummer (1)
- jmgarnier (1)
- ruslanglo (1)
- Bill (1)
Top Pull Request Authors
- michaelglass (9)
- olleolleolle (4)
- dthorsen (3)
- santib (2)
- dwbutler (2)
- rimian (2)
- BrianHicks (1)
- sunflat (1)
- LilyReile (1)
- knu (1)
- y-yagi (1)
- sb8244 (1)
- aeberlin (1)
- james-dominy (1)
- oehlschl (1)
Top Issue Labels
- enhancement (8)
- bug (3)
- question (1)
Top Pull Request Labels
- hold (2)
- enhancement (1)
Package metadata
- Total packages: 14
-
Total downloads:
- rubygems: 233,102,060 total
- Total docker downloads: 1,146,169,548
- Total dependent packages: 71 (may contain duplicates)
- Total dependent repositories: 3,963 (may contain duplicates)
- Total versions: 106
- Total maintainers: 3
gem.coop: rspec-retry
retry intermittently failing rspec examples
- Homepage: http://github.com/NoRedInk/rspec-retry
- Documentation: http://www.rubydoc.info/gems/rspec-retry/
- Licenses: MIT
- Latest release: 0.6.2 (published over 6 years ago)
- Last Synced: 2026-03-02T03:31:42.818Z (1 day ago)
- Versions: 24
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 116,549,930 Total
- Docker Downloads: 573,084,774
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.095%
- Docker downloads count: 0.161%
- Downloads: 0.22%
- Maintainers (3)
debian-13: ruby-rspec-retry
- Homepage: https://github.com/NoRedInk/rspec-retry
- Documentation: https://packages.debian.org/trixie/ruby-rspec-retry
- Licenses: mit
- Latest release: 0.6.2-2 (published 19 days ago)
- Last Synced: 2026-02-13T13:19:16.710Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.338%
- Forks count: 0.651%
- Stargazers count: 0.7%
rubygems.org: rspec-retry
retry intermittently failing rspec examples
- Homepage: http://github.com/NoRedInk/rspec-retry
- Documentation: http://www.rubydoc.info/gems/rspec-retry/
- Licenses: MIT
- Latest release: 0.6.2 (published over 6 years ago)
- Last Synced: 2026-03-02T05:03:15.224Z (1 day ago)
- Versions: 24
- Dependent Packages: 71
- Dependent Repositories: 3,963
- Downloads: 116,552,130 Total
- Docker Downloads: 573,084,774
-
Rankings:
- Docker downloads count: 0.201%
- Downloads: 0.242%
- Dependent packages count: 0.426%
- Dependent repos count: 0.5%
- Average: 1.074%
- Stargazers count: 2.368%
- Forks count: 2.708%
- Maintainers (3)
proxy.golang.org: github.com/NoRedInk/rspec-retry
- Homepage:
- Documentation: https://pkg.go.dev/github.com/NoRedInk/rspec-retry#section-documentation
- Licenses: mit
- Latest release: v0.6.2 (published over 6 years ago)
- Last Synced: 2026-02-28T11:01:13.647Z (3 days ago)
- Versions: 24
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Stargazers count: 2.518%
- Forks count: 2.636%
- Average: 6.383%
- Dependent packages count: 9.576%
- Dependent repos count: 10.802%
proxy.golang.org: github.com/noredink/rspec-retry
- Homepage:
- Documentation: https://pkg.go.dev/github.com/noredink/rspec-retry#section-documentation
- Licenses: mit
- Latest release: v0.6.2 (published over 6 years ago)
- Last Synced: 2026-02-28T11:01:13.358Z (3 days ago)
- Versions: 24
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Stargazers count: 2.518%
- Forks count: 2.636%
- Average: 6.383%
- Dependent packages count: 9.576%
- Dependent repos count: 10.802%
ubuntu-22.04: ruby-rspec-retry
- Homepage: https://github.com/NoRedInk/rspec-retry
- Licenses:
- Latest release: 0.6.2-2 (published 18 days ago)
- Last Synced: 2026-02-13T13:25:24.094Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-10: ruby-rspec-retry
- Homepage: https://github.com/NoRedInk/rspec-retry
- Documentation: https://packages.debian.org/buster/ruby-rspec-retry
- Licenses:
- Latest release: 0.5.7-1 (published 20 days ago)
- Last Synced: 2026-02-13T04:25:31.403Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-23.10: ruby-rspec-retry
- Homepage: https://github.com/NoRedInk/rspec-retry
- Licenses:
- Latest release: 0.6.2-2 (published 18 days ago)
- Last Synced: 2026-02-13T18:31:51.537Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-23.04: ruby-rspec-retry
- Homepage: https://github.com/NoRedInk/rspec-retry
- Licenses:
- Latest release: 0.6.2-2 (published 20 days ago)
- Last Synced: 2026-02-11T06:48:56.840Z (20 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-20.04: ruby-rspec-retry
- Homepage: https://github.com/NoRedInk/rspec-retry
- Licenses:
- Latest release: 0.6.2-1 (published 18 days ago)
- Last Synced: 2026-02-13T07:22:09.540Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-11: ruby-rspec-retry
- Homepage: https://github.com/NoRedInk/rspec-retry
- Documentation: https://packages.debian.org/bullseye/ruby-rspec-retry
- Licenses:
- Latest release: 0.6.2-1 (published 20 days ago)
- Last Synced: 2026-02-13T08:24:32.764Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-12: ruby-rspec-retry
- Homepage: https://github.com/NoRedInk/rspec-retry
- Documentation: https://packages.debian.org/bookworm/ruby-rspec-retry
- Licenses:
- Latest release: 0.6.2-2 (published 18 days ago)
- Last Synced: 2026-02-12T23:40:18.701Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
Score: 31.0966893453742