Commit 19ade869 authored by Michael Kozono's avatar Michael Kozono

Avoid 500 when saving long values

parent 5bd999ba
......@@ -15,7 +15,7 @@ class GeoNode < ApplicationRecord
has_many :namespaces, through: :geo_node_namespace_links
has_one :status, class_name: 'GeoNodeStatus'
validates :name, presence: true, uniqueness: { case_sensitive: false }
validates :name, presence: true, uniqueness: { case_sensitive: false }, length: { maximum: 255 }
validates :url, presence: true, addressable_url: true
validates :internal_url, addressable_url: true, allow_blank: true, allow_nil: true
......
......@@ -33,6 +33,7 @@ describe GeoNode, :geo, type: :model do
it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_presence_of(:url) }
it { is_expected.to validate_uniqueness_of(:name).case_insensitive }
it { is_expected.to validate_length_of(:name).is_at_most(255) }
context 'when validating primary node' do
it 'cannot be disabled' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment