Commit cbd41c03 authored by Thong Kuah's avatar Thong Kuah

Merge branch 'pl-factories-trait-valid' into 'master'

Document the expected validation of factories and their traits

See merge request gitlab-org/gitlab!55619
parents 3b6ae621 24237e79
......@@ -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.
- Factories don't have to be limited to `ActiveRecord` objects.
[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
......
......@@ -5,6 +5,10 @@ require 'spec_helper'
RSpec.describe 'factories' do
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
[
[: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