Test contact transfer more extensively

#660
This commit is contained in:
Artur Beljajev 2018-01-25 13:26:52 +02:00
parent 0a04f19e69
commit 29141110cc

View file

@ -6,18 +6,20 @@ class ContactTransferTest < ActiveSupport::TestCase
@new_registrar = registrars(:goodnames)
end
def test_rejects_absent_auth_info
def test_invalid_without_auth_info
@contact.auth_info = nil
@contact.validate
assert @contact.invalid?
end
def test_generates_unique_auth_info_if_contact_is_new
def test_generates_default_auth_info
contact = Contact.new
refute_empty contact.auth_info
end
def test_generated_auth_info_is_random
contact = Contact.new
another_contact = Contact.new
refute_empty contact.auth_info
refute_empty another_contact.auth_info
refute_equal contact.auth_info, another_contact.auth_info
end
@ -28,6 +30,11 @@ class ContactTransferTest < ActiveSupport::TestCase
assert_equal original_auth_info, @contact.auth_info
end
def test_overrides_default_auth_info
contact = Contact.new(auth_info: '1bad4f')
assert_equal '1bad4f', contact.auth_info
end
def test_keeps_original_contact_untouched
original_hash = @contact.to_json
new_contact = @contact.transfer(@new_registrar)