Require Contact#auth_info

#660
This commit is contained in:
Artur Beljajev 2018-01-25 12:53:47 +02:00
parent 435e1d5d64
commit 1fdd3482f0
2 changed files with 7 additions and 0 deletions

View file

@ -2,6 +2,7 @@ module Concerns::Contact::Transferable
extend ActiveSupport::Concern
included do
validates :auth_info, presence: true
after_initialize :generate_auth_info, if: :new_record?
end

View file

@ -6,6 +6,12 @@ class ContactTransferTest < ActiveSupport::TestCase
@new_registrar = registrars(:goodnames)
end
def test_rejects_absent_auth_info
@contact.auth_info = nil
@contact.validate
assert @contact.invalid?
end
def test_generates_unique_auth_info_if_contact_is_new
contact = Contact.new
another_contact = Contact.new