diff options
Diffstat (limited to 'spec/tooling')
-rw-r--r-- | spec/tooling/danger/specs/project_factory_suggestion_spec.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/spec/tooling/danger/specs/project_factory_suggestion_spec.rb b/spec/tooling/danger/specs/project_factory_suggestion_spec.rb index 95ffcfb1460..9b10ab1a6f4 100644 --- a/spec/tooling/danger/specs/project_factory_suggestion_spec.rb +++ b/spec/tooling/danger/specs/project_factory_suggestion_spec.rb @@ -18,9 +18,17 @@ RSpec.describe Tooling::Danger::Specs::ProjectFactorySuggestion, feature_categor %<suggested_line>s ``` - Project creations are very slow. Use `let_it_be`, `build` or `build_stubbed` if possible. - See [testing best practices](https://docs.gitlab.com/ee/development/testing_guide/best_practices.html#optimize-factory-usage) - for background information and alternative options. + Project creations are very slow. Using `let_it_be`, `build` or `build_stubbed` can improve test performance. + + Warning: `let_it_be` may not be suitable if your test modifies data as this could result in state leaks! + + In those cases, please use `let_it_be_with_reload` or `let_it_be_with_refind` instead. + + If your are unsure which is the right method to use, + please refer to [testing best practices](https://docs.gitlab.com/ee/development/testing_guide/best_practices.html#optimize-factory-usage) + for background information and alternative options for optimizing factory usage. + + Feel free to ignore this comment if you know `let` or `let!` are the better options and/or worry about causing state leaks. MARKDOWN end |