Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Prevent retry error when example metadata is missing

Christophe Bliardc2b9ccea0bf2
diff --git a/spec/support/rspec_retry.rb b/spec/support/rspec_retry.rb
index 5fdc863f582..e75d4ac6dbf 100644
--- a/spec/support/rspec_retry.rb
+++ b/spec/support/rspec_retry.rb
@@ -42,7 +42,7 @@ def retry_block(args: {}, screenshot: false, &block)
end
log_errors = Proc.new do |exception, try, elapsed_time, next_interval|
- max_tries = RSpec.current_example.metadata[:retry] + 1
+ max_tries = args[:tries] || (RSpec.current_example.metadata[:retry].to_i + 1)
exception_source_line = exception.backtrace.find { |line| line.start_with?(Rails.root.to_s) }
next_try_message = next_interval ? "#{next_interval} seconds until the next try" : "last try"
# use stderr directly to prevent having StructuredWarnings::StandardWarning