mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 16:16:21 +00:00
permitir punto al final del dominio
This commit is contained in:
parent
2471dad5b2
commit
52e2eb7c39
3 changed files with 7 additions and 4 deletions
|
@ -9,7 +9,10 @@ class Site < ApplicationRecord
|
|||
# @see app/services/site_service.rb
|
||||
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
|
||||
validate :deploy_local_presence
|
||||
validates_inclusion_of :status, in: %w[waiting enqueued building]
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
= f.text_field :name,
|
||||
class: form_control(site, :name),
|
||||
required: true,
|
||||
pattern: '^([a-z0-9][a-z0-9\-]*)?[a-z0-9]$',
|
||||
pattern: '^([a-z0-9][a-z0-9\-]*)?[a-z0-9\.]$',
|
||||
minlength: 1,
|
||||
maxlength: 63
|
||||
- if invalid? site, :name
|
||||
|
|
|
@ -32,11 +32,11 @@ class SiteTest < ActiveSupport::TestCase
|
|||
assert_not site.errors.messages[:name].present?
|
||||
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.validate
|
||||
|
||||
assert site.errors.messages[:name].present?
|
||||
assert_not site.errors.messages[:name].present?
|
||||
end
|
||||
|
||||
test 'el nombre del sitio no puede contener wildcard' do
|
||||
|
|
Loading…
Reference in a new issue