How to set up autotest to rerun only failing rspec examples
My impression of how autotest is intended to work (based on the cucumber github wiki, and other stuff online) is that it should rerun red examples until they pass. My problem is that it reruns all examples in the spec file where a failing example is found, including passing ones. I'd rather not waste time 开发者_如何学运维rerunning passing examples while fixing a failing one. Can autotest be configured so only the failing examples are run?
You need the rspec-retry gem. Here are some examples from the docs on how to implement it:
Apply it in a configure
block covering your entire test-suite...
RSpec.configure do |config|
config.verbose_retry = true # show retry status in spec process
config.default_retry_count = 3
end
Or apply it unit-by-unit...
it 'should randomly succeed', :retry => 3 do
expect(rand(2)).to eq(1)
end
精彩评论