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
5ce1698f
Commit
5ce1698f
authored
Sep 24, 2020
by
Igor Drozdov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Describe factory_default: :keep in docs
parent
334e139d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
doc/development/testing_guide/best_practices.md
doc/development/testing_guide/best_practices.md
+4
-1
No files found.
doc/development/testing_guide/best_practices.md
View file @
5ce1698f
...
...
@@ -151,11 +151,14 @@ In order to reuse a single object for all calls to a named factory in implicit p
can be used:
```
ruby
RSpec
.
describe
API
::
Search
,
factory_default: :keep
do
let_it_be
(
:namespace
)
{
create_default
(
:namespace
)
}
```
Then every project we create will use this
`namespace`
, without us having to pass
it as
`namespace: namespace`
.
it as
`namespace: namespace`
. In order to make it work along with
`let_it_be`
,
`factory_default: :keep`
must be explicitly specified. That will keep the default factory for every example in a suite instead of
recreating it for each example.
Maybe we don't need to create 208 different projects - we
can create one and reuse it. In addition, we can see that only about 1/3 of the
...
...
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