10 lines
353 B
Ruby
10 lines
353 B
Ruby
|
# CronTimeZoneValidator
|
||
|
#
|
||
|
# Custom validator for CronTimeZone.
|
||
|
class CronTimeZoneValidator < ActiveModel::EachValidator
|
||
|
def validate_each(record, attribute, value)
|
||
|
cron_parser = Gitlab::Ci::CronParser.new(record.cron, record.cron_time_zone)
|
||
|
record.errors.add(attribute, " is invalid syntax") unless cron_parser.cron_time_zone_valid?
|
||
|
end
|
||
|
end
|