Re-run (retry) failed RSpec examples.
Latest commit 37955c0 Jul 3, 2015 @thekendalmiller thekendalmiller Merge pull request #47 from nruth/patch-1
docs: retry_count example and how to use in zsh
Failed to load latest commit information.
lib/rspec-rerun v1.1.0 Jul 2, 2015
spec Test against multiple RSpec versions. Jul 2, 2015
.gitignore Added backward compatible support for RSpec 2. Aug 19, 2014
.rspec Added Rake tasks. Aug 14, 2012
.rubocop.yml cleanup rubocop May 14, 2015
.travis.yml Test against multiple RSpec versions. Jul 2, 2015 v1.1.0 Jul 2, 2015 Added CONTRIBUTING. Mar 10, 2015
Gemfile Test against multiple RSpec versions. Jul 2, 2015 Updated LICENSE years and README. Mar 10, 2015 docs: retry_count example and how to use in zsh Jul 3, 2015 simplify release process May 12, 2015
Rakefile move files around for simpler / more intuitive setup May 13, 2015 add pre 1.0 to 1.0 upgrading instructions May 13, 2015
rspec-rerun.gemspec remove rspec-legacy_formatters to fix output with rspec-core 3.3 Jul 2, 2015
rspec-rerun.png Added logo. Aug 14, 2012


Gem Version Build Status Dependency Status Code Climate

rspec-rerun reruns failed RSpec examples (for brittle tests).

It writes failed examples to the file rspec.failures and feeds these back to RSpec via -e.


(For RSpec 2 use version '~> 0.3.1'. )

# Gemfile
group :development, :test do
  gem 'rspec-rerun'
# Rakefile
require 'rspec-rerun/tasks'
task default: 'rspec-rerun:spec'
echo rspec.failures >> .gitignore

Run rake or rake rspec-rerun:spec. Failed examples will be rerun automatically.


The rspec-rerun:spec task accepts the following parameters:

  • retry_count: number of retries, defaults to 1

e.g. rake rspec-rerun:spec[3]. ZSH users will want to try noglob or quote around the task name: rake 'rspec-rerun:spec[3]'.

You can set the following global environment variables:

  • RSPEC_RERUN_RETRY_COUNT: number of retries, defaults to the value of retry_count or 1
  • RSPEC_RERUN_PATTERN: spec file pattern, defaults to the value defined by RSpec::Core::RakeTask
  • RSPEC_RERUN_TAG: only execute the tag specified
  • RSPEC_RERUN_VERBOSE: if 'false', don't show the rspec command invoked by Rake


Rerunning failed specs has been a long requested feature #456 in RSpec. A viable approach was suggested in #596. The infrastructure from that pull request was merged and released with rspec-core 2.11, which enabled re-running specs outside of RSpec, as described in our blog post. This gem has evolved from it.



Copyright and License

MIT License, see LICENSE for details.

(c) 2012-2015 Artsy Inc., Daniel Doubrovkine and Contributors