Silence warnings for shared groups missing feature_category metadata
What does this MR do and why?
We recently introduced a Cop to forbid metadata in shared groups This change also disables the rspec warnings if the example is a shared group as the warnings can be confusing.
This change only affects specs that do no have feature_category metadata and include shared groups. If the spec includes feature_category metadata the warning is already silenced as the metadata is applied to the included group.
When we warn for shared groups the warnings are confusing as it directs the user to add feature_category metadata to the shared group e.g.
Missing metadata feature_category: ./ee/spec/support/shared_examples/controllers/cluster_metrics_shared_examples.rb:19 See https://docs.gitlab.com/ee/development/testing_guide/best_practices.html#feature-category-metadata
, however, with the new cop this is invalid.
How to set up and validate locally
- Checkout master
- Run a spec which includes a shared group without feature_category metadata e.g. bin/rspec ee/spec/controllers/admin/clusters_controller_spec.rb:14
- Observe that you see warnings pointing to
ee/spec/support/shared_examples/controllers/cluster_metrics_shared_examples.rb
in the console - checkout this branch
git checkout chore/silence-invalid-feature-category-warnings
- Run spec again
bin/rspec ee/spec/controllers/admin/clusters_controller_spec.rb:14
- Observe warnings pointing to
ee/spec/controllers/admin/clusters_controller_spec.rb
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.