Attribute rich text editor specs to the markdown category
What does this MR do and why?
The rich text editor - * shared examples cover
app/assets/javascripts/content_editor (groupknowledge), but they inherit
the feature_category of whichever spec includes them. There is no single host
— they are pulled into seven spec files across three unrelated categories:
| Host spec | Category it reports under today |
|---|---|
work_items/issues/new/user_creates_issue_spec.rb |
team_planning |
work_items/issues/user_comments_on_issue_spec.rb |
team_planning |
merge_request/user_edits_merge_request_spec.rb |
code_review_workflow |
merge_request/user_comments_on_merge_request_spec.rb |
code_review_workflow |
projects/wiki_spec.rb (via the wiki shared examples) |
wiki |
ee/.../groups/wiki_spec.rb (via the wiki shared examples) |
wiki |
So a content editor regression is routed to whichever team happens to host the examples. This MR tags the groups and examples inside the shared example blocks so the category travels with them into every host, present and future:
describe 'autocomplete suggestions', feature_category: :markdown do18 declarations across the 8 files — every top-level describe/context, plus
the three loose examples in common_shared_examples.rb.
Why not on the RSpec.shared_examples declaration
RSpec.shared_examples 'rich text editor - autocomplete', feature_category: :markdown
looks like the obvious place, but it is wrong here, in two ways.
The suite leaves shared_context_metadata_behavior at RSpec's default of
:trigger_inclusion. Under that mode, metadata on a shared group means "include
these examples into every group carrying this metadata" — it would inject the
entire rich text editor suite into all 156 specs tagged
feature_category: :markdown. Verified:
some other markdown-tagged spec example FROM the shared group fc=:markdown # never asked for itAnd it does not even achieve the goal: the group that genuinely calls
it_behaves_like still reported fc=:team_planning.
it_behaves_like 'rich text editor - autocomplete', feature_category: :markdown
does not work either — extra arguments are forwarded to the shared example block
as parameters, so the category is unchanged and the block's params default is
overridden, silently dropping seven examples.
Verified
Per-example feature_category is what gets reported
(spec/support/formatters/json_formatter.rb). Dry-run through that formatter,
before and after, across three hosts with three different categories:
| Host spec | before | after |
|---|---|---|
user_creates_issue_spec.rb |
86 team_planning |
24 team_planning + 62 markdown |
user_edits_merge_request_spec.rb |
20 code_review_workflow |
10 code_review_workflow + 10 markdown |
wiki_spec.rb |
180 wiki |
153 wiki + 27 markdown |
Totals conserved, so no example was missed by tagging at group level. No spec files moved, no examples added or removed, and no example names changed.
Also confirmed no accidental auto-inclusion: spec/features/markdown/ specs
report 26 examples both before and after.