Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/release_highlights/validator/entry.rb')
-rw-r--r--lib/release_highlights/validator/entry.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/release_highlights/validator/entry.rb b/lib/release_highlights/validator/entry.rb
index dff55eead2f..2b4889e0131 100644
--- a/lib/release_highlights/validator/entry.rb
+++ b/lib/release_highlights/validator/entry.rb
@@ -5,16 +5,16 @@ module ReleaseHighlights
include ActiveModel::Validations
include ActiveModel::Validations::Callbacks
- PACKAGES = %w(Free Premium Ultimate).freeze
+ AVAILABLE_IN = %w(Free Premium Ultimate).freeze
attr_reader :entry
- validates :title, :body, :stage, presence: true
+ validates :name, :description, :stage, presence: true
validates :'self-managed', :'gitlab-com', inclusion: { in: [true, false], message: "must be a boolean" }
- validates :url, :image_url, public_url: { dns_rebind_protection: true }
+ validates :documentation_link, :image_url, public_url: { dns_rebind_protection: true }
validates :release, numericality: true
validate :validate_published_at
- validate :validate_packages
+ validate :validate_available_in
after_validation :add_line_numbers_to_errors!
@@ -30,11 +30,11 @@ module ReleaseHighlights
errors.add(:published_at, 'must be valid Date')
end
- def validate_packages
- packages = value_for('packages')
+ def validate_available_in
+ available_in = value_for('available_in')
- if !packages.is_a?(Array) || packages.empty? || packages.any? { |p| PACKAGES.exclude?(p) }
- errors.add(:packages, "must be one of #{PACKAGES}")
+ if !available_in.is_a?(Array) || available_in.empty? || available_in.any? { |p| AVAILABLE_IN.exclude?(p) }
+ errors.add(:available_in, "must be one of #{AVAILABLE_IN}")
end
end
@@ -71,7 +71,7 @@ module ReleaseHighlights
end
def find_node(key)
- entry.children.find {|node| node.try(:value) == key.to_s }
+ entry.children.find { |node| node.try(:value) == key.to_s }
end
end
end