Skip to content
代码片段 群组 项目
提交 53da4358 编辑于 作者: 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
No related branches found
No related tags found
无相关合并请求
...@@ -23,10 +23,10 @@ and effective _as well as_ fast. ...@@ -23,10 +23,10 @@ and effective _as well as_ fast.
Here are some things to keep in mind regarding test performance: 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`. - `FactoryBot.build(...)` and `.build_stubbed` are faster than `.create`.
- Don't `create` an object when `build`, `build_stubbed`, `attributes_for`, - 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 - 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! to be valid. Headless browser testing is slow!
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册