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

Allow retry_block on RSpec::Expectations::ExpectationNotMetError too.

Dombi Attila3b7b6c3a5576
diff --git a/spec/support/components/projects/project_life_cycles/edit_dialog.rb b/spec/support/components/projects/project_life_cycles/edit_dialog.rb
index a0ce072c7f9..83c1a3fce9f 100644
--- a/spec/support/components/projects/project_life_cycles/edit_dialog.rb
+++ b/spec/support/components/projects/project_life_cycles/edit_dialog.rb
@@ -150,8 +150,6 @@ module Components
else
expect(parent).to have_no_selector(selector)
end
- rescue StandardError
- raise "Expected to#{present ? '' : ' not'} have a visible selector '#{selector}'."
end
end
end
diff --git a/spec/support/rspec_retry.rb b/spec/support/rspec_retry.rb
index 281fe977979..8145d377aac 100644
--- a/spec/support/rspec_retry.rb
+++ b/spec/support/rspec_retry.rb
@@ -76,6 +76,11 @@ def retry_block(args: {}, screenshot: false, &)
end
end
+ # By default retry_block works with StandardError, but the ExpectationNotMetError is
+ # not inherited from StandardError. Adding the RSpec::Expectations::ExpectationNotMetError
+ # will makes sure we retry if an expectation fails inside the retry_block.
+ args[:on] ||= [StandardError, RSpec::Expectations::ExpectationNotMetError]
+
Retriable.retriable(on_retry: log_errors, **args, &)
end