Skip to content

Allow shared examples to be inline

charlie ablett requested to merge cablett-shared-context-docs into master

What does this MR do?

@digitalmoksha asked if shared_examples had to go into the spec/support/shared_examples folder, even if the examples were only ever used in one file.

According to our Testing Best Practices

All shared examples should be placed under spec/support/shared_examples/.

When asked in chat, @rspeicher replied:

To my knowledge there's not a rule. It's fine to declare them inline if they're only used by multiple tests in a single file, for example. But generally if multiple tests are/will use them, it makes sense to be in a shared file that's included everywhere.

So this MR helps our testing docs reflect reality 🙂

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Rémy Coutable

Merge request reports