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
- 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 new Pull Request