Commit 53da4358 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'pl-doc-testing-guide-speed' into 'master'

Prefer `instance_double` in testing best practices

See merge request gitlab-org/gitlab!32085
parents 29a8d9df 0ea2508a
......@@ -23,10 +23,10 @@ and effective _as well as_ fast.
Here are some things to keep in mind regarding test performance:
- `double` and `spy` are faster than `FactoryBot.build(...)`
- `instance_double` and `spy` are faster than `FactoryBot.build(...)`
- `FactoryBot.build(...)` and `.build_stubbed` are faster than `.create`.
- Don't `create` an object when `build`, `build_stubbed`, `attributes_for`,
`spy`, or `double` will do. Database persistence is slow!
`spy`, or `instance_double` will do. Database persistence is slow!
- Don't mark a feature as requiring JavaScript (through `:js` in RSpec) unless it's _actually_ required for the test
to be valid. Headless browser testing is slow!
......
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