mirror of
https://github.com/internetee/registry.git
synced 2025-07-29 22:16:19 +02:00
Merge branch 'master' into 499-admin-wildcard-search
This commit is contained in:
parent
f93286c2e6
commit
fd6e625d25
49 changed files with 382 additions and 160 deletions
|
@ -41,10 +41,8 @@ class RegistrantUserTest < ActiveSupport::TestCase
|
|||
|
||||
company = Company.new(org.ident, "ace")
|
||||
|
||||
company_register = Minitest::Mock.new
|
||||
company_register.expect(:representation_rights, [company], [{ citizen_personal_code: '1234',
|
||||
citizen_country_code: 'USA' }])
|
||||
@user.companies(company_register)
|
||||
Spy.on(@user, :companies).and_return([company])
|
||||
@user.update_company_contacts
|
||||
org.reload
|
||||
|
||||
assert_equal org.name, company.company_name
|
||||
|
@ -63,6 +61,39 @@ class RegistrantUserTest < ActiveSupport::TestCase
|
|||
company_register.verify
|
||||
end
|
||||
|
||||
def test_should_return_zero_count_of_companies
|
||||
assert_equal 'US-1234', @user.registrant_ident
|
||||
org = contacts(:acme_ltd)
|
||||
org.ident_country_code = 'EE'
|
||||
org.save(validate: false)
|
||||
org.reload
|
||||
|
||||
company_one = Company.new(org.ident, 'Acme Ltd')
|
||||
|
||||
Spy.on(@user, :companies).and_return([company_one])
|
||||
response = @user.do_need_update_contact?
|
||||
org.reload
|
||||
|
||||
assert_equal response[:counter], 0
|
||||
end
|
||||
|
||||
def test_should_return_count_of_contact_which_should_be_updated
|
||||
assert_equal 'US-1234', @user.registrant_ident
|
||||
org = contacts(:acme_ltd)
|
||||
org.ident_country_code = 'EE'
|
||||
org.save(validate: false)
|
||||
org.reload
|
||||
|
||||
company_one = Company.new(org.ident, 'ace')
|
||||
company_two = Company.new(org.ident, 'acer')
|
||||
|
||||
Spy.on(@user, :companies).and_return([company_one, company_two])
|
||||
response = @user.do_need_update_contact?
|
||||
org.reload
|
||||
|
||||
assert_equal response[:counter], 2
|
||||
end
|
||||
|
||||
def test_returns_contacts
|
||||
Contact.stub(:registrant_user_contacts, %w(john jane)) do
|
||||
assert_equal %w(john jane), @user.contacts
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue