mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 12:47:29 +02:00
Fix error if domain name was nil.
Used for some old history entries Closes #1663
This commit is contained in:
parent
76e4e32dc9
commit
a0029d0a80
2 changed files with 9 additions and 2 deletions
|
@ -260,8 +260,8 @@ class Domain < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def name=(value)
|
def name=(value)
|
||||||
value.strip!
|
value&.strip!
|
||||||
value.downcase!
|
value&.downcase!
|
||||||
self[:name] = SimpleIDN.to_unicode(value)
|
self[:name] = SimpleIDN.to_unicode(value)
|
||||||
self[:name_puny] = SimpleIDN.to_ascii(value)
|
self[:name_puny] = SimpleIDN.to_ascii(value)
|
||||||
self[:name_dirty] = value
|
self[:name_dirty] = value
|
||||||
|
|
|
@ -270,6 +270,13 @@ class DomainTest < ActiveSupport::TestCase
|
||||||
assert_equal 'shop.test', domain.domain_name.to_s
|
assert_equal 'shop.test', domain.domain_name.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_nil_name_doesnt_throw_error
|
||||||
|
domain = Domain.new(name: 'shop.test')
|
||||||
|
assert_nothing_raised do
|
||||||
|
domain.name = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_returns_registrant_user_domains_by_registrant
|
def test_returns_registrant_user_domains_by_registrant
|
||||||
registrant = contacts(:john).becomes(Registrant)
|
registrant = contacts(:john).becomes(Registrant)
|
||||||
assert_equal registrant, @domain.registrant
|
assert_equal registrant, @domain.registrant
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue