RSpec::Retry adds :retry
option to rspec example.
It is for randomly failing example.
If example has :retry
, rspec retry specified times until success.
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
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
- :verbose_retry(default: false) Print retry status
- :default_retry_count(default: 1) If retry count is not set in example, this value is used by default
- :clear_lets_on_failure(default: true) Clear memoized value for
let
before retrying
- 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