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
53f9c447
Commit
53f9c447
authored
Oct 06, 2020
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mention explicit/implicit association set up in testing guide docs
parent
6cf719ee
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
doc/development/testing_guide/best_practices.md
doc/development/testing_guide/best_practices.md
+4
-0
No files found.
doc/development/testing_guide/best_practices.md
View file @
53f9c447
...
...
@@ -890,6 +890,10 @@ GitLab uses [factory_bot](https://github.com/thoughtbot/factory_bot) as a test f
resulting record to pass validation.
-
When instantiating from a factory, don't supply attributes that aren't
required by the test.
-
Prefer
[
implicit
](
https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#implicit-definition
)
or
[
explicit
](
https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#explicit-definition
)
association definitions instead of using
`create`
/
`build`
for association setup.
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
)
.
...
...
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