Commit 24237e79 authored by Peter Leitzen's avatar Peter Leitzen Committed by Thong Kuah

Document the expected validation of factories and its traits

parent 24414956
...@@ -986,6 +986,7 @@ GitLab uses [factory_bot](https://github.com/thoughtbot/factory_bot) as a test f ...@@ -986,6 +986,7 @@ GitLab uses [factory_bot](https://github.com/thoughtbot/factory_bot) as a test f
See [issue #262624](https://gitlab.com/gitlab-org/gitlab/-/issues/262624) for further context. See [issue #262624](https://gitlab.com/gitlab-org/gitlab/-/issues/262624) for further context.
- Factories don't have to be limited to `ActiveRecord` objects. - Factories don't have to be limited to `ActiveRecord` objects.
[See example](https://gitlab.com/gitlab-org/gitlab-foss/commit/0b8cefd3b2385a21cfed779bd659978c0402766d). [See example](https://gitlab.com/gitlab-org/gitlab-foss/commit/0b8cefd3b2385a21cfed779bd659978c0402766d).
- Factories and their traits should produce valid objects that are [verified by specs](https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/factories_spec.rb).
### Fixtures ### Fixtures
......
...@@ -5,6 +5,10 @@ require 'spec_helper' ...@@ -5,6 +5,10 @@ require 'spec_helper'
RSpec.describe 'factories' do RSpec.describe 'factories' do
include Database::DatabaseHelpers include Database::DatabaseHelpers
# https://gitlab.com/groups/gitlab-org/-/epics/5464 tracks the remaining
# skipped traits.
#
# Consider adding a code comment if a trait cannot produce a valid object.
def skipped_traits def skipped_traits
[ [
[:audit_event, :unauthenticated], [:audit_event, :unauthenticated],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment