0.09
Low commit activity in last 3 years
A long-lived project that still receives updates
Re-run failed RSpec tests.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0

Runtime

~> 3.0
 Project Readme

rspec-rerun

Gem Version Test

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.

Installation

Add rspec-rerun to your Gemfile. For RSpec 2, use version ~> 0.3.1.

# Gemfile
group :development, :test do
  gem 'rspec-rerun'
end

Usage

Load the tasks in your Rakefile.

# Rakefile
require 'rspec-rerun/tasks'
task default: 'rspec-rerun:spec'

Ignore the failures file.

echo rspec.failures >> .gitignore

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

Configuration

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

  • retry_count: number of retries, defaults to 1

For example, rake rspec-rerun:spec[3]. Zsh users should use noglob or quote 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

History

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.

Contributing

See CONTRIBUTING, CHANGELOG, UPGRADING, and RELEASING.

Copyright and License

MIT License, see LICENSE for details.

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