mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 22:54:47 +02:00
parent
56e3f236bc
commit
00041df311
5 changed files with 30 additions and 3 deletions
|
@ -2,7 +2,7 @@ class Nameserver < ActiveRecord::Base
|
|||
include Versions # version/nameserver_version.rb
|
||||
include EppErrors
|
||||
|
||||
belongs_to :domain
|
||||
belongs_to :domain, required: true
|
||||
|
||||
# rubocop: disable Metrics/LineLength
|
||||
validates :hostname, format: { with: /\A(([a-zA-Z0-9]|[a-zA-ZäöüõšžÄÖÜÕŠŽ0-9][a-zA-ZäöüõšžÄÖÜÕŠŽ0-9\-]*[a-zA-ZäöüõšžÄÖÜÕŠŽ0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])\z/ }
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class ChangeNameserversDomainIdToNotNull < ActiveRecord::Migration
|
||||
def change
|
||||
change_column_null :nameservers, :domain_id, false
|
||||
end
|
||||
end
|
|
@ -2226,7 +2226,7 @@ CREATE TABLE nameservers (
|
|||
created_at timestamp without time zone,
|
||||
updated_at timestamp without time zone,
|
||||
ipv6 character varying[] DEFAULT '{}'::character varying[],
|
||||
domain_id integer,
|
||||
domain_id integer NOT NULL,
|
||||
creator_str character varying,
|
||||
updator_str character varying,
|
||||
legacy_domain_id integer,
|
||||
|
@ -3628,7 +3628,7 @@ ALTER TABLE ONLY settings
|
|||
|
||||
|
||||
--
|
||||
-- Name: unique_contact_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
-- Name: unique_contact_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY contacts
|
||||
|
@ -5080,3 +5080,5 @@ INSERT INTO schema_migrations (version) VALUES ('20180126104903');
|
|||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20180129143538');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20180129232054');
|
||||
|
||||
|
|
3
test/fixtures/nameservers.yml
vendored
Normal file
3
test/fixtures/nameservers.yml
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
ns1:
|
||||
hostname: ns1.bestnames.test
|
||||
domain: shop
|
17
test/models/nameserver_test.rb
Normal file
17
test/models/nameserver_test.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
require 'test_helper'
|
||||
|
||||
class NameserverTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
@nameserver = nameservers(:ns1)
|
||||
end
|
||||
|
||||
def test_valid
|
||||
assert @nameserver.valid?
|
||||
end
|
||||
|
||||
def test_invalid_without_domain
|
||||
@nameserver.domain = nil
|
||||
@nameserver.validate
|
||||
assert @nameserver.invalid?
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue