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
25018521
Commit
25018521
authored
Aug 21, 2020
by
Sean Arnold
Committed by
Mike Jang
Aug 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Factory profiler to best practices documentation
parent
652e84b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
doc/development/testing_guide/best_practices.md
doc/development/testing_guide/best_practices.md
+20
-0
No files found.
doc/development/testing_guide/best_practices.md
View file @
25018521
...
...
@@ -64,6 +64,26 @@ Use [Factory Doctor](https://test-prof.evilmartians.io/#/profilers/factory_docto
FDOC
=
1 bin/rspec spec/[path]/[to]/[spec].rb
```
[
Factory Profiler
](
https://test-prof.evilmartians.io/#/profilers/factory_prof
)
can help to identify unnecessary factory creation.
```
shell
# run test for path
FPROF
=
1 bin/rspec spec/[path]/[to]/[spec].rb
# to visualize with a flamegraph
FPROF
=
flamegraph bin/rspec spec/[path]/[to]/[spec].rb
```
A common change is to use
[
`let_it_be`
](
#common-test-setup
)
.
```
ruby
# Old
let
(
:project
)
{
create
(
:project
)
}
# New
let_it_be
(
:project
)
{
create
(
:project
)
}
```
### General guidelines
-
Use a single, top-level
`RSpec.describe ClassName`
block.
...
...
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