Backend: Fix inclusion validation for CI entries
As we realized in !101350 (merged);
We have the "inclusion" validation for the
whenkeyword but no validation for its type. So, the attribute also accepts an array as the value. The "inclusion" validation ofActiveModel::Validationsalso accepts array values and compares each element.
class MyTestClass
include ActiveModel::Validations
attr_accessor :title
validates_inclusion_of :title, in: %w[abc def]
end
t = MyTestClass.new
t.title = 'abc'
t.valid? # => true
t.title = 'ghi'
t.valid? # => false
t.title = ['abc']
t.valid? # => true
We fixed that problem in that MR for the Entry::Job and Entry::Bridge entries. In this issue, we'll check other CI entries. For example; we have other when attributes for Entry::Change and Entry::Artifacts.
Implementation
| backend | MR |
|---|---|
Fix inclusion validation for CI entries (Fixed entries Entry::Artifacts and Entry::Cache) |
!105149 (merged) |
Edited by Leaminn Ma