Optimize factory usage for Groups::UpdateService test

Summary

When running spec/services/groups/update_service_spec.rb, I notice that there is room for improving the factory usage and consequently the test runtime.

[TEST PROF INFO] Time spent in factories: 00:42.394 (45.45% of total time)
[TEST PROF INFO] Factories usage

 Total: 1014
 Total top-level: 306
 Total time: 00:42.394 (out of 01:55.292)
 Total uniq factories: 16

   name                    total   top-level     total time      time per call      top-level time

   common_organization       280           0        1.5579s            0.0056s             0.0000s
   group                     203         203       23.8149s            0.1173s            23.8149s
   namespace_settings        203           0        1.7223s            0.0085s             0.0000s
   namespace_ci_cd_settings      203           0        1.0074s            0.0050s             0.0000s
   user                       81          64       10.2005s            0.1259s             8.5147s
   project                    17          17        8.3648s            0.4920s             8.3648s
   crm_settings                7           7        0.0386s            0.0055s             0.0386s
   container_repository        4           4        0.0886s            0.0222s             0.0886s
   npm_package                 3           3        0.3518s            0.1173s             0.3518s
   package_file                3           0        0.2875s            0.0958s             0.0000s
   issue                       2           2        0.8818s            0.4409s             0.8818s
   work_item_type              2           0        0.0179s            0.0090s             0.0000s
   contact                     2           2        0.1198s            0.0599s             0.1198s
   issue_customer_relations_contact        2           2        0.0251s            0.0125s             0.0251s
   admin                       1           1        0.1773s            0.1773s             0.1773s
   license                     1           1        0.0170s            0.0170s             0.0170s

Improvements

  • Use let_it_be blocks
Edited by 🤖 GitLab Bot 🤖