mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 13:36:15 +02:00
Merge branch 'master' into 2275-fix-csv-view-for-historical-data
This commit is contained in:
commit
a7b9fb7bb6
13 changed files with 131 additions and 42 deletions
|
@ -17,7 +17,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Login to container registry
|
- name: Login to container registry
|
||||||
env:
|
env:
|
||||||
|
|
6
.github/workflows/ruby.yml
vendored
6
.github/workflows/ruby.yml
vendored
|
@ -22,7 +22,7 @@ jobs:
|
||||||
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
|
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: ruby/setup-ruby@v1
|
- uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
ruby-version: ${{ matrix.ruby }}
|
ruby-version: ${{ matrix.ruby }}
|
||||||
|
@ -79,7 +79,7 @@ jobs:
|
||||||
- name: Save coverage
|
- name: Save coverage
|
||||||
run: ./cc-test-reporter format-coverage --output coverage/codeclimate.${{ matrix.ruby }}.json
|
run: ./cc-test-reporter format-coverage --output coverage/codeclimate.${{ matrix.ruby }}.json
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v2.3.1
|
- uses: actions/upload-artifact@v3.0.0
|
||||||
with:
|
with:
|
||||||
name: coverage-${{ matrix.ruby }}
|
name: coverage-${{ matrix.ruby }}
|
||||||
path: coverage/codeclimate.${{ matrix.ruby }}.json
|
path: coverage/codeclimate.${{ matrix.ruby }}.json
|
||||||
|
@ -104,7 +104,7 @@ jobs:
|
||||||
- name: Give test coverage reporter executable permissions
|
- name: Give test coverage reporter executable permissions
|
||||||
run: chmod +x cc-test-reporter
|
run: chmod +x cc-test-reporter
|
||||||
|
|
||||||
- uses: actions/download-artifact@v2.1.0
|
- uses: actions/download-artifact@v3.0.0
|
||||||
with:
|
with:
|
||||||
name: coverage-${{ matrix.ruby }}
|
name: coverage-${{ matrix.ruby }}
|
||||||
path: coverage
|
path: coverage
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -9,6 +9,7 @@
|
||||||
/config/application.yml
|
/config/application.yml
|
||||||
/config/environments/development.rb
|
/config/environments/development.rb
|
||||||
/config/deploy.rb
|
/config/deploy.rb
|
||||||
|
/config/master.key
|
||||||
/.idea
|
/.idea
|
||||||
|
|
||||||
# Do not commit one. Instead, download the latest from https://github.com/internetee/style-guide.
|
# Do not commit one. Instead, download the latest from https://github.com/internetee/style-guide.
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
3.1.1
|
3.0.3
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
31.03.2022
|
||||||
|
* Sidekiq update to 6.4.1 [#2322](https://github.com/internetee/registry/pull/2322)
|
||||||
|
|
||||||
|
25.03.2022
|
||||||
|
* Bulk change of business contacts' names requires now user confirmation [#2309](https://github.com/internetee/registry/pull/2309)
|
||||||
|
|
||||||
23.02.2022
|
23.02.2022
|
||||||
* FD notes are updated when basis for FD changes [#2216](https://github.com/internetee/registry/issues/2216)
|
* FD notes are updated when basis for FD changes [#2216](https://github.com/internetee/registry/issues/2216)
|
||||||
* Admin: date filter end date in domain hostory is now inclusive [#2274](https://github.com/internetee/registry/issues/2274)
|
* Admin: date filter end date in domain hostory is now inclusive [#2274](https://github.com/internetee/registry/issues/2274)
|
||||||
|
|
8
Gemfile
8
Gemfile
|
@ -17,9 +17,9 @@ gem 'figaro', '~> 1.2'
|
||||||
|
|
||||||
# model related
|
# model related
|
||||||
gem 'paper_trail', '~> 12.1'
|
gem 'paper_trail', '~> 12.1'
|
||||||
gem 'pg', '1.3.3'
|
gem 'pg', '1.3.5'
|
||||||
# 1.8 is for Rails < 5.0
|
# 1.8 is for Rails < 5.0
|
||||||
gem 'ransack', '~> 2.5.0'
|
gem 'ransack', '~> 2.6.0'
|
||||||
gem 'truemail', '~> 2.4' # validates email by regexp, mail server existence and address existence
|
gem 'truemail', '~> 2.4' # validates email by regexp, mail server existence and address existence
|
||||||
gem 'validates_email_format_of', '1.6.3' # validates email against RFC 2822 and RFC 3696
|
gem 'validates_email_format_of', '1.6.3' # validates email against RFC 2822 and RFC 3696
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ gem 'select2-rails', '4.0.13' # for autocomplete
|
||||||
gem 'selectize-rails', '0.12.6' # include selectize.js for select
|
gem 'selectize-rails', '0.12.6' # include selectize.js for select
|
||||||
|
|
||||||
# registry specfic
|
# registry specfic
|
||||||
gem 'data_migrate', '~> 7.0'
|
gem 'data_migrate', '~> 8.0'
|
||||||
gem 'dnsruby', '~> 1.61'
|
gem 'dnsruby', '~> 1.61'
|
||||||
gem 'isikukood' # for EE-id validation
|
gem 'isikukood' # for EE-id validation
|
||||||
gem 'money-rails'
|
gem 'money-rails'
|
||||||
|
@ -70,7 +70,7 @@ gem 'jquery-ui-rails', '6.0.1'
|
||||||
gem 'pdfkit'
|
gem 'pdfkit'
|
||||||
gem 'que'
|
gem 'que'
|
||||||
gem 'que-web'
|
gem 'que-web'
|
||||||
gem 'sidekiq'
|
gem 'sidekiq', '>= 6.4.1'
|
||||||
|
|
||||||
gem 'company_register', github: 'internetee/company_register',
|
gem 'company_register', github: 'internetee/company_register',
|
||||||
branch: 'master'
|
branch: 'master'
|
||||||
|
|
42
Gemfile.lock
42
Gemfile.lock
|
@ -193,7 +193,7 @@ GEM
|
||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.12.2)
|
coffee-script-source (1.12.2)
|
||||||
concurrent-ruby (1.1.9)
|
concurrent-ruby (1.1.10)
|
||||||
connection_pool (2.2.5)
|
connection_pool (2.2.5)
|
||||||
countries (4.0.1)
|
countries (4.0.1)
|
||||||
i18n_data (~> 0.13.0)
|
i18n_data (~> 0.13.0)
|
||||||
|
@ -205,7 +205,7 @@ GEM
|
||||||
daemons-rails (1.2.1)
|
daemons-rails (1.2.1)
|
||||||
daemons
|
daemons
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
data_migrate (7.0.2)
|
data_migrate (8.0.0)
|
||||||
activerecord (>= 5.0)
|
activerecord (>= 5.0)
|
||||||
railties (>= 5.0)
|
railties (>= 5.0)
|
||||||
database_cleaner (2.0.1)
|
database_cleaner (2.0.1)
|
||||||
|
@ -258,7 +258,7 @@ GEM
|
||||||
httpi (2.4.5)
|
httpi (2.4.5)
|
||||||
rack
|
rack
|
||||||
socksify
|
socksify
|
||||||
i18n (1.8.11)
|
i18n (1.10.0)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
i18n_data (0.13.0)
|
i18n_data (0.13.0)
|
||||||
isikukood (0.1.2)
|
isikukood (0.1.2)
|
||||||
|
@ -289,7 +289,7 @@ GEM
|
||||||
kaminari-core (1.2.1)
|
kaminari-core (1.2.1)
|
||||||
libxml-ruby (3.2.1)
|
libxml-ruby (3.2.1)
|
||||||
logger (1.4.3)
|
logger (1.4.3)
|
||||||
loofah (2.12.0)
|
loofah (2.16.0)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.5.9)
|
||||||
mail (2.7.1)
|
mail (2.7.1)
|
||||||
|
@ -303,7 +303,7 @@ GEM
|
||||||
nokogiri (~> 1)
|
nokogiri (~> 1)
|
||||||
rake
|
rake
|
||||||
mini_mime (1.1.1)
|
mini_mime (1.1.1)
|
||||||
mini_portile2 (2.7.1)
|
mini_portile2 (2.8.0)
|
||||||
minitest (5.15.0)
|
minitest (5.15.0)
|
||||||
monetize (1.9.4)
|
monetize (1.9.4)
|
||||||
money (~> 6.12)
|
money (~> 6.12)
|
||||||
|
@ -324,10 +324,10 @@ GEM
|
||||||
newrelic_rpm (= 8.1.0)
|
newrelic_rpm (= 8.1.0)
|
||||||
newrelic_rpm (8.1.0)
|
newrelic_rpm (8.1.0)
|
||||||
nio4r (2.5.8)
|
nio4r (2.5.8)
|
||||||
nokogiri (1.13.0)
|
nokogiri (1.13.3)
|
||||||
mini_portile2 (~> 2.7.0)
|
mini_portile2 (~> 2.8.0)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
nokogiri (1.13.0-x86_64-linux)
|
nokogiri (1.13.3-x86_64-linux)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
nori (2.6.0)
|
nori (2.6.0)
|
||||||
omniauth (1.9.1)
|
omniauth (1.9.1)
|
||||||
|
@ -351,7 +351,7 @@ GEM
|
||||||
activerecord (>= 5.2)
|
activerecord (>= 5.2)
|
||||||
request_store (~> 1.1)
|
request_store (~> 1.1)
|
||||||
pdfkit (0.8.5)
|
pdfkit (0.8.5)
|
||||||
pg (1.3.3)
|
pg (1.3.5)
|
||||||
pg_query (2.1.2)
|
pg_query (2.1.2)
|
||||||
google-protobuf (>= 3.17.1)
|
google-protobuf (>= 3.17.1)
|
||||||
pghero (2.8.1)
|
pghero (2.8.1)
|
||||||
|
@ -360,7 +360,7 @@ GEM
|
||||||
coderay (~> 1.1)
|
coderay (~> 1.1)
|
||||||
method_source (~> 1.0)
|
method_source (~> 1.0)
|
||||||
public_suffix (4.0.6)
|
public_suffix (4.0.6)
|
||||||
puma (5.6.2)
|
puma (5.6.4)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
que (0.14.3)
|
que (0.14.3)
|
||||||
que-web (0.7.2)
|
que-web (0.7.2)
|
||||||
|
@ -406,9 +406,9 @@ GEM
|
||||||
rake (>= 0.13)
|
rake (>= 0.13)
|
||||||
thor (~> 1.0)
|
thor (~> 1.0)
|
||||||
rake (13.0.6)
|
rake (13.0.6)
|
||||||
ransack (2.5.0)
|
ransack (2.6.0)
|
||||||
activerecord (>= 5.2.4)
|
activerecord (>= 6.0.4)
|
||||||
activesupport (>= 5.2.4)
|
activesupport (>= 6.0.4)
|
||||||
i18n
|
i18n
|
||||||
rbtree3 (0.6.0)
|
rbtree3 (0.6.0)
|
||||||
redis (4.6.0)
|
redis (4.6.0)
|
||||||
|
@ -449,7 +449,7 @@ GEM
|
||||||
selenium-webdriver (3.142.7)
|
selenium-webdriver (3.142.7)
|
||||||
childprocess (>= 0.5, < 4.0)
|
childprocess (>= 0.5, < 4.0)
|
||||||
rubyzip (>= 1.2.2)
|
rubyzip (>= 1.2.2)
|
||||||
sidekiq (6.4.0)
|
sidekiq (6.4.1)
|
||||||
connection_pool (>= 2.2.2)
|
connection_pool (>= 2.2.2)
|
||||||
rack (~> 2.0)
|
rack (~> 2.0)
|
||||||
redis (>= 4.2.0)
|
redis (>= 4.2.0)
|
||||||
|
@ -480,7 +480,7 @@ GEM
|
||||||
attr_required (>= 0.0.5)
|
attr_required (>= 0.0.5)
|
||||||
httpclient (>= 2.4)
|
httpclient (>= 2.4)
|
||||||
temple (0.8.2)
|
temple (0.8.2)
|
||||||
thor (1.1.0)
|
thor (1.2.1)
|
||||||
tilt (2.0.10)
|
tilt (2.0.10)
|
||||||
truemail (2.4.9)
|
truemail (2.4.9)
|
||||||
simpleidn (~> 0.2.1)
|
simpleidn (~> 0.2.1)
|
||||||
|
@ -524,7 +524,7 @@ GEM
|
||||||
wkhtmltopdf-binary (0.12.5.4)
|
wkhtmltopdf-binary (0.12.5.4)
|
||||||
xpath (3.2.0)
|
xpath (3.2.0)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
zeitwerk (2.5.2)
|
zeitwerk (2.5.4)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
@ -544,7 +544,7 @@ DEPENDENCIES
|
||||||
company_register!
|
company_register!
|
||||||
countries
|
countries
|
||||||
daemons-rails (= 1.2.1)
|
daemons-rails (= 1.2.1)
|
||||||
data_migrate (~> 7.0)
|
data_migrate (~> 8.0)
|
||||||
database_cleaner
|
database_cleaner
|
||||||
devise (~> 4.8)
|
devise (~> 4.8)
|
||||||
digidoc_client!
|
digidoc_client!
|
||||||
|
@ -574,7 +574,7 @@ DEPENDENCIES
|
||||||
omniauth-tara!
|
omniauth-tara!
|
||||||
paper_trail (~> 12.1)
|
paper_trail (~> 12.1)
|
||||||
pdfkit
|
pdfkit
|
||||||
pg (= 1.3.3)
|
pg (= 1.3.5)
|
||||||
pg_query (>= 0.9.0)
|
pg_query (>= 0.9.0)
|
||||||
pghero
|
pghero
|
||||||
pry (= 0.14.1)
|
pry (= 0.14.1)
|
||||||
|
@ -582,13 +582,13 @@ DEPENDENCIES
|
||||||
que
|
que
|
||||||
que-web
|
que-web
|
||||||
rails (~> 6.1.4)
|
rails (~> 6.1.4)
|
||||||
ransack (~> 2.5.0)
|
ransack (~> 2.6.0)
|
||||||
rest-client
|
rest-client
|
||||||
rexml
|
rexml
|
||||||
sass-rails
|
sass-rails
|
||||||
select2-rails (= 4.0.13)
|
select2-rails (= 4.0.13)
|
||||||
selectize-rails (= 0.12.6)
|
selectize-rails (= 0.12.6)
|
||||||
sidekiq
|
sidekiq (>= 6.4.1)
|
||||||
simplecov (= 0.17.1)
|
simplecov (= 0.17.1)
|
||||||
simpleidn (= 0.2.1)
|
simpleidn (= 0.2.1)
|
||||||
spy
|
spy
|
||||||
|
@ -601,4 +601,4 @@ DEPENDENCIES
|
||||||
wkhtmltopdf-binary (~> 0.12.5.1)
|
wkhtmltopdf-binary (~> 0.12.5.1)
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.2.31
|
2.3.9
|
||||||
|
|
|
@ -34,6 +34,17 @@ module Api
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def do_need_update_contact
|
||||||
|
result = current_registrant_user.do_need_update_contact?
|
||||||
|
render json: { update_contacts: result[:result], counter: result[:counter] }
|
||||||
|
end
|
||||||
|
|
||||||
|
def update_company_contacts
|
||||||
|
companies = current_registrant_user.update_company_contacts
|
||||||
|
|
||||||
|
render json: { message: 'get it', companies: companies }
|
||||||
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
logger.debug 'Received update request'
|
logger.debug 'Received update request'
|
||||||
logger.debug params
|
logger.debug params
|
||||||
|
|
|
@ -11,6 +11,8 @@ module Domains
|
||||||
domains = domain_contacts.map(&:domain).flatten +
|
domains = domain_contacts.map(&:domain).flatten +
|
||||||
Domain.where(registrant_id: registrant_ids)
|
Domain.where(registrant_id: registrant_ids)
|
||||||
|
|
||||||
|
return if expired_or_hold_domains_exists?(domains)
|
||||||
|
|
||||||
domains.each do |domain|
|
domains.each do |domain|
|
||||||
next if domain.expired?
|
next if domain.expired?
|
||||||
|
|
||||||
|
@ -20,6 +22,12 @@ module Domains
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def expired_or_hold_domains_exists?(domains)
|
||||||
|
domains.any? do |domain|
|
||||||
|
domain.statuses.include?(DomainStatus::SERVER_HOLD) && email.include?(domain.name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def before_execute_force_delete(domain)
|
def before_execute_force_delete(domain)
|
||||||
if domain.force_delete_scheduled? && !domain.status_notes[DomainStatus::FORCE_DELETE].nil?
|
if domain.force_delete_scheduled? && !domain.status_notes[DomainStatus::FORCE_DELETE].nil?
|
||||||
added_additional_email_into_notes(domain)
|
added_additional_email_into_notes(domain)
|
||||||
|
|
|
@ -20,16 +20,27 @@ class RegistrantUser < User
|
||||||
def companies(company_register = CompanyRegister::Client.new)
|
def companies(company_register = CompanyRegister::Client.new)
|
||||||
return [] if ident.include?('-')
|
return [] if ident.include?('-')
|
||||||
|
|
||||||
companies = company_register.representation_rights(citizen_personal_code: ident,
|
company_register.representation_rights(citizen_personal_code: ident,
|
||||||
citizen_country_code: country.alpha3)
|
citizen_country_code: country.alpha3)
|
||||||
|
|
||||||
companies = update_contacts_before_receive(companies)
|
|
||||||
companies
|
|
||||||
rescue CompanyRegister::NotAvailableError
|
rescue CompanyRegister::NotAvailableError
|
||||||
return []
|
[]
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_contacts_before_receive(companies)
|
def do_need_update_contact?
|
||||||
|
return { result: false, counter: 0 } if companies.blank?
|
||||||
|
|
||||||
|
counter = 0
|
||||||
|
companies.each do |company|
|
||||||
|
counter += Contact.where(ident: company.registration_number, ident_country_code: 'EE')&.
|
||||||
|
reject { |contact| contact.name == company.company_name }.size
|
||||||
|
end
|
||||||
|
|
||||||
|
return { result: true, counter: counter } if counter.positive?
|
||||||
|
|
||||||
|
{ result: false, counter: 0 }
|
||||||
|
end
|
||||||
|
|
||||||
|
def update_company_contacts
|
||||||
return [] if companies.blank?
|
return [] if companies.blank?
|
||||||
|
|
||||||
companies.each do |company|
|
companies.each do |company|
|
||||||
|
|
|
@ -128,7 +128,10 @@ Rails.application.routes.draw do
|
||||||
resources :domains, only: %i[index show], param: :uuid do
|
resources :domains, only: %i[index show], param: :uuid do
|
||||||
resource :registry_lock, only: %i[create destroy]
|
resource :registry_lock, only: %i[create destroy]
|
||||||
end
|
end
|
||||||
resources :contacts, only: %i[index show update], param: :uuid
|
resources :contacts, only: %i[index show update], param: :uuid do
|
||||||
|
get 'do_need_update_contact', to: 'contacts#do_need_update_contact', as: :do_need_update_contact
|
||||||
|
post 'update_company_contacts', to: 'contacts#update_company_contacts', as: :update_company_contacts
|
||||||
|
end
|
||||||
resources :companies, only: %i[index]
|
resources :companies, only: %i[index]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
18
test/interactions/force_delete_email/base_test.rb
Normal file
18
test/interactions/force_delete_email/base_test.rb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class BaseTest < ActiveSupport::TestCase
|
||||||
|
def test_hold_domains_force_delete_email
|
||||||
|
domain = domains(:shop)
|
||||||
|
domain.update!(statuses: [DomainStatus::SERVER_HOLD])
|
||||||
|
domain.update!(expire_time: Time.zone.now + 1.year)
|
||||||
|
|
||||||
|
registrant = domain.registrant
|
||||||
|
registrant.update!(email: "#{registrant.email.split('@').first}@#{domain.name}")
|
||||||
|
|
||||||
|
Domains::ForceDeleteEmail::Base.run(email: registrant.email)
|
||||||
|
|
||||||
|
domain.reload
|
||||||
|
|
||||||
|
assert_not domain.force_delete_scheduled?
|
||||||
|
end
|
||||||
|
end
|
|
@ -41,10 +41,8 @@ class RegistrantUserTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
company = Company.new(org.ident, "ace")
|
company = Company.new(org.ident, "ace")
|
||||||
|
|
||||||
company_register = Minitest::Mock.new
|
Spy.on(@user, :companies).and_return([company])
|
||||||
company_register.expect(:representation_rights, [company], [{ citizen_personal_code: '1234',
|
@user.update_company_contacts
|
||||||
citizen_country_code: 'USA' }])
|
|
||||||
@user.companies(company_register)
|
|
||||||
org.reload
|
org.reload
|
||||||
|
|
||||||
assert_equal org.name, company.company_name
|
assert_equal org.name, company.company_name
|
||||||
|
@ -63,6 +61,39 @@ class RegistrantUserTest < ActiveSupport::TestCase
|
||||||
company_register.verify
|
company_register.verify
|
||||||
end
|
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
|
def test_returns_contacts
|
||||||
Contact.stub(:registrant_user_contacts, %w(john jane)) do
|
Contact.stub(:registrant_user_contacts, %w(john jane)) do
|
||||||
assert_equal %w(john jane), @user.contacts
|
assert_equal %w(john jane), @user.contacts
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue