permitir punto al final del dominio

This commit is contained in:
f 2019-11-18 14:08:30 -03:00
parent 2471dad5b2
commit 52e2eb7c39
No known key found for this signature in database
GPG key ID: 2AE5A13E321F953D
3 changed files with 7 additions and 4 deletions

View file

@ -9,7 +9,10 @@ class Site < ApplicationRecord
# @see app/services/site_service.rb # @see app/services/site_service.rb
DEPLOYS = %i[local www zip].freeze DEPLOYS = %i[local www zip].freeze
validates :name, uniqueness: true, hostname: true validates :name, uniqueness: true, hostname: {
allow_root_label: true
}
validates :design_id, presence: true validates :design_id, presence: true
validate :deploy_local_presence validate :deploy_local_presence
validates_inclusion_of :status, in: %w[waiting enqueued building] validates_inclusion_of :status, in: %w[waiting enqueued building]

View file

@ -10,7 +10,7 @@
= f.text_field :name, = f.text_field :name,
class: form_control(site, :name), class: form_control(site, :name),
required: true, required: true,
pattern: '^([a-z0-9][a-z0-9\-]*)?[a-z0-9]$', pattern: '^([a-z0-9][a-z0-9\-]*)?[a-z0-9\.]$',
minlength: 1, minlength: 1,
maxlength: 63 maxlength: 63
- if invalid? site, :name - if invalid? site, :name

View file

@ -32,11 +32,11 @@ class SiteTest < ActiveSupport::TestCase
assert_not site.errors.messages[:name].present? assert_not site.errors.messages[:name].present?
end end
test 'el nombre del sitio no puede terminar con punto' do test 'el nombre del sitio puede terminar con punto' do
site = build :site, name: 'hola.chau.' site = build :site, name: 'hola.chau.'
site.validate site.validate
assert site.errors.messages[:name].present? assert_not site.errors.messages[:name].present?
end end
test 'el nombre del sitio no puede contener wildcard' do test 'el nombre del sitio no puede contener wildcard' do