ruby rspec_retry.rb

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ruby rspec_retry.rb相关的知识,希望对你有一定的参考价值。

# frozen_string_literal: true

require 'rspec/retry'

RSpec.configure do |config|
  if ENV['RAKSUL_AD_RSPEC_RETRY']&.match?(/true/i)
    # show retry status in spec process
    config.verbose_retry = true
    # show exception that triggers a retry if verbose_retry is set to true
    config.display_try_failure_messages = true

    # run retry only on features
    config.around :each, type: :system do |ex|
      retry_num = ex.metadata[:retry] || ENV['RAKSUL_AD_RSPEC_RETRY_NUM']&.to_i || 2
      ex.run_with_retry retry: retry_num
    end

    # callback to be run between retries
    config.retry_callback = proc do |ex|
      # run some additional clean up task - can be filtered by example metadata
      Capybara.reset! if ex.metadata[:system]
    end
  end
end

以上是关于ruby rspec_retry.rb的主要内容,如果未能解决你的问题,请参考以下文章

Ruby运算符

Ruby 25 岁了!Ruby 之父说 Ruby 3 有望 3 倍提速

如何学习ruby?Ruby学习技巧分享

ruby Ruby脚本,看看是否用openssl编译了ruby

什么是ruby?

ruby和ruby ee