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

Add circuit breaker to fail suite regardless of linting

Oliver Günther988c693f79b3
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 63c7d536018..b9bb72e5cce 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -74,13 +74,6 @@ RSpec.configure do |config|
# triggering implicit auto-inclusion in groups with matching metadata.
config.shared_context_metadata_behavior = :apply_to_host_groups
- # This allows you to limit a spec run to individual examples or groups
- # you care about by tagging them with `:focus` metadata. When nothing
- # is tagged with `:focus`, all examples get run. RSpec also provides
- # aliases for `it`, `describe`, and `context` that include `:focus`
- # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
- config.filter_run_when_matching :focus
-
# Allows RSpec to persist some state between runs in order to support
# the `--only-failures` and `--next-failure` CLI options. We recommend
# you configure your source control system to ignore this file.
diff --git a/spec/support/focused_spec_circuit_breaker.rb b/spec/support/focused_spec_circuit_breaker.rb
new file mode 100644
index 00000000000..0e76bac0065
--- /dev/null
+++ b/spec/support/focused_spec_circuit_breaker.rb
@@ -0,0 +1,15 @@
+##
+# Add circuit breakers for CI builds, such as focused specs
+# that somehow elude linting
+RSpec.configure do |config|
+ if ENV["CI"]
+ config.before(:example, :focus) { |example| raise "Found focused example at #{example.location}" }
+ else
+ # This allows you to limit a spec run to individual examples or groups
+ # you care about by tagging them with `:focus` metadata. When nothing
+ # is tagged with `:focus`, all examples get run. RSpec also provides
+ # aliases for `it`, `describe`, and `context` that include `:focus`
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
+ config.filter_run_when_matching :focus
+ end
+end