internetee-registry/test/models/registrant_user_test.rb
Maciej Szlosarczyk 9623e2fb97
Refactor RegistrantUser class
* Extract frequently used country_code and ident methods
* Refactor domain query
* Add contact query method
* Add adminstrated_domains query method. Name will most likely change
  in the future developments
* Change registry locks integration test name
2018-08-23 16:00:44 +03:00

31 lines
793 B
Ruby

require 'test_helper'
class RegistrantUserTest < ActiveSupport::TestCase
def setup
super
@user = RegistrantUser.new(registrant_ident: 'US-1234')
end
def teardown
super
end
def test_domains_returns_an_list_of_domains_associated_with_a_specific_id_code
domain_names = @user.domains.pluck(:name)
assert_equal(3, domain_names.length)
end
def test_administrated_domains_returns_a_list_of_domains_that_is_smaller_than_domains
assert_equal(2, @user.administrated_domains.count)
end
def test_contacts_returns_an_list_of_contacts_associated_with_a_specific_id_code
assert_equal(1, @user.contacts.count)
end
def test_ident_and_country_code_helper_methods
assert_equal('1234', @user.ident)
assert_equal('US', @user.country_code)
end
end