DRY new_project_sast_enabled experiment field with partials
What does this MR do and why?
This MR encapsulations some duplication between experiment variations in a partial.
(Copied from !76899 (comment 784278341)):
- DRY'ing this removes any concern about error between the consistency of the experiments
- It's not clear at first glance what the complete and actual difference is between the experiments (even though the names are descriptive).
- Moving this to a partial improves it's own readability (because it doesn't have to be nested) + the readability of the original file since it doesn't include a big conditional block.
I'd rather have a temporary partial than temporary duplication.
Screenshots
Nothing should have changed in this MR and here's screenshots verifying locally:
control | cadidate | free_indicator | unchecked_cadidate | unchecked_free_indicator |
---|---|---|---|---|
How to set up and validate locally
(Copied from !76899 (merged))
- Enable the experiment
Feature.enable(:new_project_sast_enabled)
- Assign the variants you want to, for your test user (assuming
root
is your test user)include Gitlab::Experiment::Dsl experiment(:new_project_sast_enabled, :control, user: User.first) # no checkboxes should be visible experiment(:new_project_sast_enabled, :candidate, user: User.first) # checkbox should be visible and checked experiment(:new_project_sast_enabled, :free_indicator, user: User.first) # checkbox should be visible and checked, and you should have a label indicating that it's free if you check it experiment(:new_project_sast_enabled, :unchecked_candidate, user: User.first) # checkbox should be visible and unchecked experiment(:new_project_sast_enabled, :unchecked_free_indicator, user: User.first) # checkbox should be visible and unchecked, with the free label
- Create a new blank project.
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 Paul Slaughter