Do not use factories in view spec
Context
Follow-up of !162700 (merged) (specifically, this comment).
What does this MR do and why?
Do not use factories in the ee/spec/views/admin/application_settings/_elasticsearch_form.html.haml_spec.rb view spec.
Factories are not needed in view specs, so this MR gets rid of them.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
I took the latest master, which is after !162700 (merged) was merged.
We are saving an additional 25 seconds
Before (master)
$ FPROF=1 EVENT_PROF='sql.active_record' be rspec ee/spec/views/admin/application_settings/_elasticsearch_form.html.haml_spec.rb
[...]
Finished in 39.47 seconds (files took 15.34 seconds to load)
41 examples, 0 failures
[TEST PROF INFO] Time spent in factories: 00:17.868 (42.91% of total time)
[TEST PROF INFO] Factories usage
Total: 470
Total top-level: 140
Total time: 00:17.868 (out of 00:49.038)
Total uniq factories: 9
total top-level total time time per call top-level time name
132 0 8.0494s 0.0610s 0.0000s namespace
132 0 0.7854s 0.0060s 0.0000s organization
66 0 12.7511s 0.1932s 0.0000s project
66 66 4.4393s 0.0673s 4.4393s elasticsearch_indexed_namespace
66 66 13.0596s 0.1979s 13.0596s elasticsearch_indexed_project
3 3 0.0088s 0.0029s 0.0088s elastic_reindexing_task
3 3 0.0100s 0.0033s 0.0100s elastic_reindexing_subtask
1 1 0.3421s 0.3421s 0.3421s admin
1 1 0.0085s 0.0085s 0.0085s license
After (this MR)
$ FPROF=1 EVENT_PROF='sql.active_record' be rspec ee/spec/views/admin/application_settings/_elasticsearch_form.html.haml_spec.rb
[...]
Finished in 14.82 seconds (files took 17.5 seconds to load)
41 examples, 0 failures
[TEST PROF INFO] Time spent in factories: 00:00.010 (0.06% of total time)
[TEST PROF INFO] Factories usage
Total: 1
Total top-level: 1
Total time: 00:00.010 (out of 00:26.219)
Total uniq factories: 1
total top-level total time time per call top-level time name
1 1 0.0105s 0.0105s 0.0105s license
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
Edited by David Dieulivol