retry randomly failing rspec example
Switch branches/tags
Nothing to show
Pull request Compare This branch is 110 commits behind NoRedInk:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
Guardfile
LICENSE
README.md
Rakefile
rspec-retry.gemspec

README.md

RSpec::Retry

RSpec::Retry adds :retry option to rspec example. It is for randomly failing example. If example has :retry, rspec retry specified times until success.

Installation

Add this line to your application's Gemfile:

gem 'rspec-retry'

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|
  config.verbose_retry = true # show retry status in spec process
end

Usage

it 'should randomly success', :retry => 3 do
  rand(2).should == 1
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

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request