Fix bug validating EE project features
What does this MR do?
In the ProjectFeature
class, we define the FEATURES
that the class is going to have. We have a validation that checks that we don't set any non-valid value in any of the features.
Nevertheless, in the ProjectFeature
EE extension, we also define the EE_FEATURES
, but we're not validating those because the validator uses directly the FEATURES
constant.
We need to use the value returned from available_features
coming from the Featurable
concern. That method returns all the features defined in both FOSS and EE.
As well, we can move the validator to the Featurable
concern because it's a generic method. We can reuse it later when we implement group features.
How to setup and validate locally (strongly suggested)
- Open the rails console and execute:
project = Project.first
project.project_feature.requirements_access_level = Featurable::PUBLIC
project.project_feature.valid?
- The
valid?
operation will returntrue
but it should befalse
.
Does this MR meet the acceptance criteria?
Conformity
-
I have included changelog trailers, or none are needed. (Does this MR need a changelog?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides. -
This change is backwards compatible across updates, or this does not apply.
Related to #338821 (closed)
Edited by Francisco Javier López