Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
24237e79
Commit
24237e79
authored
Mar 03, 2021
by
Peter Leitzen
Committed by
Thong Kuah
Mar 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document the expected validation of factories and its traits
parent
24414956
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
0 deletions
+5
-0
doc/development/testing_guide/best_practices.md
doc/development/testing_guide/best_practices.md
+1
-0
spec/factories_spec.rb
spec/factories_spec.rb
+4
-0
No files found.
doc/development/testing_guide/best_practices.md
View file @
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
...
...
spec/factories_spec.rb
View file @
24237e79
...
...
@@ -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
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment