mirror of
https://github.com/internetee/registry.git
synced 2025-05-28 12:31:21 +02:00
Domain name validator
This commit is contained in:
parent
8f131c2fe4
commit
b670331b1a
4 changed files with 25 additions and 0 deletions
|
@ -10,5 +10,17 @@ describe Domain do
|
|||
it 'creates a resource' do
|
||||
d = Fabricate(:domain)
|
||||
expect(d.name).to_not be_nil
|
||||
|
||||
invalid = ['a.ee', "#{'a' * 64}.ee", 'ab.eu', 'test.ab.ee', '-test.ee', '-test-.ee', 'test-.ee', 'te--st.ee']
|
||||
|
||||
invalid.each do |x|
|
||||
expect(Fabricate.build(:domain, name: x).valid?).to be false
|
||||
end
|
||||
|
||||
valid = ['ab.ee', "#{'a' * 63}.ee", 'te-s-t.ee']
|
||||
|
||||
valid.each do |x|
|
||||
expect(Fabricate.build(:domain, name: x).valid?).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue