Initialize random string per workspace factory instance
What does this MR do and why?
Prior this change "random string" was defined when the factory was loaded and not instantiated. This made the string non-random for all factories.
This commit defines this string on instance level via a transient attributes. This makes this string random per factory instantiation.
Spotted while reviewing/testing #409930.
How to set up and validate locally
In Rails console:
Before
The name suffix is static:
FactoryBot.build_stubbed(:workspace).name # => "workspace-1029-1018-mz4t9g"
FactoryBot.build_stubbed(:workspace).name # => "workspace-1044-1033-mz4t9g"
After
The name suffix is dynamic:
FactoryBot.build_stubbed(:workspace).name # => "workspace-1043-1032-pp6lvu"
FactoryBot.build_stubbed(:workspace).name # => "workspace-1058-1047-lqwvbp"
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Peter Leitzen