Merge pull request #540 from internetee/registry-480

Registry 480
This commit is contained in:
Timo Võhmar 2017-06-09 16:41:03 +03:00 committed by GitHub
commit d453242ea2
92 changed files with 882 additions and 1215 deletions

1
.gitignore vendored
View file

@ -11,7 +11,6 @@ capybara-*.html
**.orig **.orig
config/initializers/secret_token.rb config/initializers/secret_token.rb
config/deploy.rb config/deploy.rb
config/secrets.yml
config/database.yml config/database.yml
config/application.yml config/application.yml
config/environments/development.rb config/environments/development.rb

View file

@ -1,10 +0,0 @@
inherit_from: .rubocop.yml
#
# Turn off during guard runs
#
# turn off comment intention check during development
# because NerdCommenter honors commented code intentions
Style/CommentIndentation:
Enabled: false

View file

@ -8,7 +8,6 @@ before_script:
- "psql -c 'create database registry_whois_test;' -U postgres" - "psql -c 'create database registry_whois_test;' -U postgres"
- "psql -c 'create database registry_api_log_test;' -U postgres" - "psql -c 'create database registry_api_log_test;' -U postgres"
- "cp config/application-example.yml config/application.yml" - "cp config/application-example.yml config/application.yml"
- "cp config/secrets-example.yml config/secrets.yml"
- "cp config/database-travis.yml config/database.yml" - "cp config/database-travis.yml config/database.yml"
- "RAILS_ENV=test bundle exec rake db:setup:all" - "RAILS_ENV=test bundle exec rake db:setup:all"
script: script:

View file

@ -114,12 +114,8 @@ gem 'jquery-ui-rails', '5.0.5'
group :development do group :development do
gem 'guard', '2.12.9' # run tests automatically
gem 'spring', '1.3.6' gem 'spring', '1.3.6'
gem 'spring-commands-rspec', '1.0.4' gem 'spring-commands-rspec', '1.0.4'
gem 'guard-rails', '0.7.1' # run EPP server automatically
gem 'guard-rspec', '4.5.2'
gem 'guard-rubocop', '1.2.0'
gem 'rubocop', '0.48.1' gem 'rubocop', '0.48.1'
# deploy # deploy
@ -129,7 +125,7 @@ end
group :development, :test do group :development, :test do
gem 'capybara' gem 'capybara'
gem 'rspec-rails', '~> 3.5' gem 'rspec-rails', '~> 3.6'
gem 'fabrication', '2.13.2' # Replacement for fixtures gem 'fabrication', '2.13.2' # Replacement for fixtures
gem 'phantomjs-binaries' gem 'phantomjs-binaries'
gem 'phantomjs' gem 'phantomjs'

View file

@ -193,7 +193,6 @@ GEM
ffi (1.9.18) ffi (1.9.18)
figaro (1.1.1) figaro (1.1.1)
thor (~> 0.14) thor (~> 0.14)
formatador (0.2.5)
globalid (0.3.7) globalid (0.3.7)
activesupport (>= 4.1.0) activesupport (>= 4.1.0)
grape (0.12.0) grape (0.12.0)
@ -206,26 +205,6 @@ GEM
rack-accept rack-accept
rack-mount rack-mount
virtus (>= 1.0.0) virtus (>= 1.0.0)
guard (2.12.9)
formatador (>= 0.2.4)
listen (>= 2.7, <= 4.0)
lumberjack (~> 1.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-compat (1.2.1)
guard-rails (0.7.1)
guard (~> 2.11)
guard-compat (~> 1.0)
guard-rspec (4.5.2)
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
guard-rubocop (1.2.0)
guard (~> 2.0)
rubocop (~> 0.20)
gyoku (1.3.1) gyoku (1.3.1)
builder (>= 2.1.2) builder (>= 2.1.2)
haml (4.0.7) haml (4.0.7)
@ -279,13 +258,8 @@ GEM
libv8 (3.16.14.19) libv8 (3.16.14.19)
libxml-ruby (3.0.0) libxml-ruby (3.0.0)
liquid (3.0.6) liquid (3.0.6)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.0.3) loofah (2.0.3)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
lumberjack (1.0.11)
mail (2.6.5) mail (2.6.5)
mime-types (>= 1.16, < 4) mime-types (>= 1.16, < 4)
method_source (0.8.2) method_source (0.8.2)
@ -296,7 +270,7 @@ GEM
open4 (~> 1.3.4) open4 (~> 1.3.4)
rake rake
mini_portile2 (2.1.0) mini_portile2 (2.1.0)
minitest (5.10.1) minitest (5.10.2)
monetize (1.6.0) monetize (1.6.0)
money (~> 6.8) money (~> 6.8)
money (6.8.3) money (6.8.3)
@ -309,14 +283,10 @@ GEM
railties (>= 3.0) railties (>= 3.0)
multi_json (1.12.1) multi_json (1.12.1)
multi_xml (0.6.0) multi_xml (0.6.0)
nenv (0.3.0)
netrc (0.11.0) netrc (0.11.0)
nokogiri (1.7.1) nokogiri (1.7.1)
mini_portile2 (~> 2.1.0) mini_portile2 (~> 2.1.0)
nori (2.6.0) nori (2.6.0)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
nprogress-rails (0.1.6.7) nprogress-rails (0.1.6.7)
open4 (1.3.4) open4 (1.3.4)
orm_adapter (0.5.0) orm_adapter (0.5.0)
@ -345,7 +315,7 @@ GEM
erubis erubis
que (~> 0.8) que (~> 0.8)
sinatra sinatra
rack (1.6.5) rack (1.6.8)
rack-accept (0.4.5) rack-accept (0.4.5)
rack (>= 0.4) rack (>= 0.4)
rack-mount (0.8.3) rack-mount (0.8.3)
@ -389,9 +359,6 @@ GEM
activesupport (>= 3.0) activesupport (>= 3.0)
i18n i18n
polyamorous (~> 1.1) polyamorous (~> 1.1)
rb-fsevent (0.9.8)
rb-inotify (0.9.8)
ffi (>= 0.5.0)
rdoc (4.3.0) rdoc (4.3.0)
ref (2.0.0) ref (2.0.0)
request_store (1.1.0) request_store (1.1.0)
@ -401,27 +368,27 @@ GEM
http-cookie (>= 1.0.2, < 2.0) http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0) mime-types (>= 1.16, < 4.0)
netrc (~> 0.8) netrc (~> 0.8)
rspec (3.5.0) rspec (3.6.0)
rspec-core (~> 3.5.0) rspec-core (~> 3.6.0)
rspec-expectations (~> 3.5.0) rspec-expectations (~> 3.6.0)
rspec-mocks (~> 3.5.0) rspec-mocks (~> 3.6.0)
rspec-core (3.5.4) rspec-core (3.6.0)
rspec-support (~> 3.5.0) rspec-support (~> 3.6.0)
rspec-expectations (3.5.0) rspec-expectations (3.6.0)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0) rspec-support (~> 3.6.0)
rspec-mocks (3.5.0) rspec-mocks (3.6.0)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0) rspec-support (~> 3.6.0)
rspec-rails (3.5.2) rspec-rails (3.6.0)
actionpack (>= 3.0) actionpack (>= 3.0)
activesupport (>= 3.0) activesupport (>= 3.0)
railties (>= 3.0) railties (>= 3.0)
rspec-core (~> 3.5.0) rspec-core (~> 3.6.0)
rspec-expectations (~> 3.5.0) rspec-expectations (~> 3.6.0)
rspec-mocks (~> 3.5.0) rspec-mocks (~> 3.6.0)
rspec-support (~> 3.5.0) rspec-support (~> 3.6.0)
rspec-support (3.5.0) rspec-support (3.6.0)
rubocop (0.48.1) rubocop (0.48.1)
parser (>= 2.3.3.1, < 3.0) parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1) powerpack (~> 0.1)
@ -429,7 +396,6 @@ GEM
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1) unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1) ruby-progressbar (1.8.1)
ruby_dep (1.5.0)
ruby_parser (3.8.4) ruby_parser (3.8.4)
sexp_processor (~> 4.1) sexp_processor (~> 4.1)
safe_yaml (1.0.4) safe_yaml (1.0.4)
@ -455,7 +421,6 @@ GEM
thor (~> 0.14) thor (~> 0.14)
selectize-rails (0.12.1) selectize-rails (0.12.1)
sexp_processor (4.8.0) sexp_processor (4.8.0)
shellany (0.0.1)
simplecov (0.10.0) simplecov (0.10.0)
docile (~> 1.1.0) docile (~> 1.1.0)
json (~> 1.8) json (~> 1.8)
@ -556,10 +521,6 @@ DEPENDENCIES
factory_girl_rails factory_girl_rails
figaro (= 1.1.1) figaro (= 1.1.1)
grape (= 0.12.0) grape (= 0.12.0)
guard (= 2.12.9)
guard-rails (= 0.7.1)
guard-rspec (= 4.5.2)
guard-rubocop (= 1.2.0)
haml-rails (= 0.9.0) haml-rails (= 0.9.0)
hashie-forbidden_attributes (= 0.1.1) hashie-forbidden_attributes (= 0.1.1)
html2haml (= 2.1.0) html2haml (= 2.1.0)
@ -593,7 +554,7 @@ DEPENDENCIES
rails-settings-cached (= 0.4.1) rails-settings-cached (= 0.4.1)
ransack (= 1.5.1) ransack (= 1.5.1)
rest-client rest-client
rspec-rails (~> 3.5) rspec-rails (~> 3.6)
rubocop (= 0.48.1) rubocop (= 0.48.1)
sass-rails (= 5.0.6) sass-rails (= 5.0.6)
sdoc (= 0.4.1) sdoc (= 0.4.1)

View file

@ -1,52 +0,0 @@
group :red_green_refactor, halt_on_fail: true do
# start test EPP server automatically on port 8989,
# be sure you have apache2 configured to
# accept EPP request on port 701, what proxy to 8989.
# port and environment is just for correct notification, all is overwritten by CLI
# guard :rails, port: 8989, environment: 'test' do
# # guard :rails, port: 8989, environment: 'test', CLI: 'RAILS_ENV=test unicorn -p 8989' do
# watch('Gemfile.lock')
# watch(%r{^(config|lib)/.*})
# end
# guard :rspec, cmd: 'spring rspec --fail-fast', notification: false do
guard :rspec, cmd: 'spring rspec', notification: false do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^app/controllers/epp/(.+)_(controller)\.rb$}) { |m| ["spec/epp/#{m[1].sub(/s$/,'')}_spec.rb"] }
watch(%r{^app/models/epp/(.+)\.rb$}) { |m| "spec/epp/#{m[1]}_spec.rb" }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
watch('spec/rails_helper.rb') { "spec" }
# epp tests
watch('app/helpers/epp/contacts_helper.rb') { 'spec/epp/contact_spec.rb' }
watch('app/helpers/epp/domains_helper.rb') { 'spec/epp/domain_spec.rb' }
# Capybara features specs
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
# Turnip features and steps
watch(%r{^spec/acceptance/(.+)\.feature$})
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
end
# Martin does not want rubocop
unless Socket.gethostname == 'martin'
guard :rubocop,
all_on_start: false,
cli: '--display-cop-names -c .rubocop-guard.yml -f fuubar',
notification: false do
watch(%r{.+\.rb$})
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
watch(%r{(?:.+/)?\.rubocop-guard\.yml$}) { |m| File.dirname(m[0]) }
end
end
end

View file

@ -7,6 +7,7 @@ class DomainUpdateConfirmJob < Que::Job
domain.is_admin = true domain.is_admin = true
case action case action
when RegistrantVerification::CONFIRMED when RegistrantVerification::CONFIRMED
old_registrant = domain.registrant
domain.poll_message!(:poll_pending_update_confirmed_by_registrant) domain.poll_message!(:poll_pending_update_confirmed_by_registrant)
raise_errors!(domain) raise_errors!(domain)
@ -15,6 +16,7 @@ class DomainUpdateConfirmJob < Que::Job
domain.clean_pendings! domain.clean_pendings!
raise_errors!(domain) raise_errors!(domain)
RegistrantChange.new(domain: domain, old_registrant: old_registrant).confirm
when RegistrantVerification::REJECTED when RegistrantVerification::REJECTED
RegistrantChangeMailer.rejected(domain: domain, RegistrantChangeMailer.rejected(domain: domain,
registrar: domain.registrar, registrar: domain.registrar,

View file

@ -1,5 +1,6 @@
class ContactMailer < ApplicationMailer class ContactMailer < ApplicationMailer
include Que::Mailer include Que::Mailer
helper_method :address_processing
def email_updated(old_email, email, contact_id, should_deliver) def email_updated(old_email, email, contact_id, should_deliver)
@contact = Contact.find_by(id: contact_id) @contact = Contact.find_by(id: contact_id)
@ -32,4 +33,10 @@ class ContactMailer < ApplicationMailer
logger.info "EMAIL SENDING FAILED: #{email}: #{e}" logger.info "EMAIL SENDING FAILED: #{email}: #{e}"
end end
end end
private
def address_processing
Contact.address_processing?
end
end end

View file

@ -1,37 +1,6 @@
class DomainMailer < ApplicationMailer class DomainMailer < ApplicationMailer
include Que::Mailer include Que::Mailer
def registrant_updated_notification_for_new_registrant(domain_id, old_registrant_id, new_registrant_id, should_deliver)
@domain = Domain.find_by(id: domain_id)
return unless @domain
return if delivery_off?(@domain, should_deliver)
@old_registrant = Registrant.find(old_registrant_id)
@new_registrant = Registrant.find(new_registrant_id)
@address_processing = Contact.address_processing?
return if whitelist_blocked?(@new_registrant.email)
mail(to: format(@new_registrant.email),
subject: "#{I18n.t(:registrant_updated_notification_for_new_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end
def registrant_updated_notification_for_old_registrant(domain_id, old_registrant_id, new_registrant_id, should_deliver)
@domain = Domain.find_by(id: domain_id)
return unless @domain
return if delivery_off?(@domain, should_deliver)
@old_registrant = Registrant.find(old_registrant_id)
@new_registrant = Registrant.find(new_registrant_id)
@address_processing = Contact.address_processing?
return if whitelist_blocked?(@old_registrant.email)
mail(to: format(@old_registrant.email),
subject: "#{I18n.t(:registrant_updated_notification_for_old_registrant_subject,
name: @domain.name)} [#{@domain.name}]")
end
def pending_delete_rejected_notification(domain_id, should_deliver) def pending_delete_rejected_notification(domain_id, should_deliver)
@domain = Domain.find_by(id: domain_id) @domain = Domain.find_by(id: domain_id)
return unless @domain return unless @domain

View file

@ -1,4 +1,6 @@
class RegistrantChangeMailer < ApplicationMailer class RegistrantChangeMailer < ApplicationMailer
helper_method :address_processing
def confirm(domain:, registrar:, current_registrant:, new_registrant:) def confirm(domain:, registrar:, current_registrant:, new_registrant:)
@domain = DomainPresenter.new(domain: domain, view: view_context) @domain = DomainPresenter.new(domain: domain, view: view_context)
@registrar = RegistrarPresenter.new(registrar: registrar, view: view_context) @registrar = RegistrarPresenter.new(registrar: registrar, view: view_context)
@ -19,6 +21,14 @@ class RegistrantChangeMailer < ApplicationMailer
mail(to: new_registrant.email, subject: subject) mail(to: new_registrant.email, subject: subject)
end end
def confirmed(domain:, old_registrant:)
@domain = domain
recipients = [domain.registrant_email, old_registrant.email]
subject = default_i18n_subject(domain_name: domain.name)
mail(to: recipients, subject: subject)
end
def rejected(domain:, registrar:, registrant:) def rejected(domain:, registrar:, registrant:)
@domain = DomainPresenter.new(domain: domain, view: view_context) @domain = DomainPresenter.new(domain: domain, view: view_context)
@registrar = RegistrarPresenter.new(registrar: registrar, view: view_context) @registrar = RegistrarPresenter.new(registrar: registrar, view: view_context)
@ -42,4 +52,8 @@ class RegistrantChangeMailer < ApplicationMailer
def confirm_url(domain) def confirm_url(domain)
registrant_domain_update_confirm_url(domain, token: domain.registrant_verification_token) registrant_domain_update_confirm_url(domain, token: domain.registrant_verification_token)
end end
def address_processing
Contact.address_processing?
end
end end

View file

@ -1,72 +0,0 @@
class Address < ActiveRecord::Base
include Versions # version/address_version.rb
LOCAL_TYPE_SHORT = 'loc'
INTERNATIONAL_TYPE_SHORT = 'int'
LOCAL_TYPE = 'LocalAddress'
TYPES = [
LOCAL_TYPE_SHORT,
INTERNATIONAL_TYPE_SHORT
]
belongs_to :contact
def country
Country.new(country_code)
end
class << self
# def validate_postal_info_types(parsed_frame)
# errors, used = [], []
# parsed_frame.css('postalInfo').each do |pi|
# attr = pi.attributes['type'].try(:value)
# errors << {
# code: 2003, msg: I18n.t('errors.messages.attr_missing', key: 'type')
# } and next unless attr
# unless TYPES.include?(attr)
# errors << {
# code: 2005,
# msg: I18n.t('errors.messages.invalid_type'), value: { obj: 'type', val: attr }
# }
# next
# end
# errors << {
# code: 2005,
# msg: I18n.t('errors.messages.repeating_postal_info')
# } and next if used.include?(attr)
# used << attr
# end; errors
# end
def extract_attributes(ah)
address_hash = {}
ah = ah.first if ah.is_a?(Array)
address_hash[:address_attributes] = addr_hash_from_params(ah)
address_hash
end
private
# def local?(postal_info)
# return :local_address_attributes if postal_info[:type] == LOCAL_TYPE_SHORT
# :international_address_attributes
# end
def addr_hash_from_params(addr)
return {} if addr.nil?
return {} unless addr[:addr].is_a?(Hash)
{ country_code: Country.new(addr[:addr][:cc]).try(:alpha2),
city: addr[:addr][:city],
street: pretty_street(addr[:addr][:street]), # [0],
# street2: addr[:addr][:street][1],
# street3: addr[:addr][:street][2],
zip: addr[:addr][:pc]
}.delete_if { |_k, v| v.nil? }
end
def pretty_street(param_street)
return param_street.join(',') if param_street.is_a?(Array)
param_street
end
end
end

View file

@ -3,11 +3,11 @@ class Contact < ActiveRecord::Base
include EppErrors include EppErrors
include UserEvents include UserEvents
belongs_to :registrar belongs_to :registrar, required: true
has_many :domain_contacts has_many :domain_contacts
has_many :domains, through: :domain_contacts has_many :domains, through: :domain_contacts
has_many :legal_documents, as: :documentable has_many :legal_documents, as: :documentable
has_many :registrant_domains, class_name: 'Domain', foreign_key: 'registrant_id' # when contant is registrant has_many :registrant_domains, class_name: 'Domain', foreign_key: 'registrant_id'
# TODO: remove later # TODO: remove later
has_many :depricated_statuses, class_name: 'DepricatedContactStatus', dependent: :destroy has_many :depricated_statuses, class_name: 'DepricatedContactStatus', dependent: :destroy
@ -19,7 +19,7 @@ class Contact < ActiveRecord::Base
accepts_nested_attributes_for :legal_documents accepts_nested_attributes_for :legal_documents
validates :name, :phone, :email, :ident, :ident_type, :registrar, presence: true validates :name, :phone, :email, :ident, :ident_type, presence: true
validates :street, :city, :zip, :country_code, presence: true, if: 'self.class.address_processing?' validates :street, :city, :zip, :country_code, presence: true, if: 'self.class.address_processing?'
validates :phone, format: /\+[0-9]{1,3}\.[0-9]{1,14}?/, phone: true validates :phone, format: /\+[0-9]{1,3}\.[0-9]{1,14}?/, phone: true
@ -429,6 +429,8 @@ class Contact < ActiveRecord::Base
end end
def related_domain_descriptions def related_domain_descriptions
ActiveSupport::Deprecation.warn('Use #domain_names_with_roles')
@desc = {} @desc = {}
registrant_domains.each do |dom| registrant_domains.each do |dom|
@ -594,4 +596,28 @@ class Contact < ActiveRecord::Base
return unless priv? return unless priv?
ident ident
end end
def ident_country
Country.new(ident_country_code)
end
def used?
registrant_domains.any? || domain_contacts.any?
end
def domain_names_with_roles
domain_names = {}
registrant_domains.pluck(:name).each do |domain_name|
domain_names[domain_name] ||= Set.new
domain_names[domain_name] << Registrant.name.underscore.to_sym
end
domain_contacts.each do |domain_contact|
domain_names[domain_contact.domain.name] ||= Set.new
domain_names[domain_contact.domain.name] << domain_contact.type.underscore.to_sym
end
domain_names
end
end end

View file

@ -19,8 +19,8 @@ class Domain < ActiveRecord::Base
# TODO: whois requests ip whitelist for full info for own domains and partial info for other domains # TODO: whois requests ip whitelist for full info for own domains and partial info for other domains
# TODO: most inputs should be trimmed before validatation, probably some global logic? # TODO: most inputs should be trimmed before validatation, probably some global logic?
belongs_to :registrar belongs_to :registrar, required: true
belongs_to :registrant belongs_to :registrant, required: true
# TODO: should we user validates_associated :registrant here? # TODO: should we user validates_associated :registrant here?
has_many :admin_domain_contacts has_many :admin_domain_contacts
@ -104,8 +104,7 @@ class Domain < ActiveRecord::Base
validates :name_dirty, domain_name: true, uniqueness: true validates :name_dirty, domain_name: true, uniqueness: true
validates :puny_label, length: { maximum: 63 } validates :puny_label, length: { maximum: 63 }
validates :period, numericality: { only_integer: true } validates :period, presence: true, numericality: { only_integer: true }
validates :registrant, :registrar, presence: true
validate :validate_reservation validate :validate_reservation
def validate_reservation def validate_reservation

View file

@ -521,9 +521,7 @@ class Epp::Domain < Domain
preclean_pendings preclean_pendings
user = ApiUser.find(pending_json['current_user_id']) user = ApiUser.find(pending_json['current_user_id'])
frame = Nokogiri::XML(pending_json['frame']) frame = Nokogiri::XML(pending_json['frame'])
old_registrant_id = registrant_id
self.deliver_emails = true # turn on email delivery
self.statuses.delete(DomainStatus::PENDING_UPDATE) self.statuses.delete(DomainStatus::PENDING_UPDATE)
self.upid = user.registrar.id if user.registrar self.upid = user.registrar.id if user.registrar
self.up_date = Time.zone.now self.up_date = Time.zone.now
@ -531,11 +529,9 @@ class Epp::Domain < Domain
return unless update(frame, user, false) return unless update(frame, user, false)
clean_pendings! clean_pendings!
save! # for notification if everything fails save!
WhoisRecord.find_by(domain_id: id).save # need to reload model WhoisRecord.find_by(domain_id: id).save # need to reload model
DomainMailer.registrant_updated_notification_for_old_registrant(id, old_registrant_id, registrant_id, true).deliver
DomainMailer.registrant_updated_notification_for_new_registrant(id, old_registrant_id, registrant_id, true).deliver
true true
end end

View file

@ -61,19 +61,9 @@ module Soap
def initialize def initialize
if self.class.username.nil? if self.class.username.nil?
if Rails.application.secrets.key?(:arireg)
arireg = Rails.application.secrets[:arireg].with_indifferent_access
self.class.username = arireg[:username]
self.class.password = arireg[:password]
if self.class.wsdl.nil? # no override of config/environments/* ?
self.class.wsdl = arireg[:wsdl]
self.class.host = arireg[:host]
end
else
self.class.username = ENV['arireg_username'] self.class.username = ENV['arireg_username']
self.class.password = ENV['arireg_password'] self.class.password = ENV['arireg_password']
end end
end
if self.class.wsdl.nil? if self.class.wsdl.nil?
self.class.wsdl = ENV['arireg_wsdl'] self.class.wsdl = ENV['arireg_wsdl']
self.class.host = ENV['arireg_host'] self.class.host = ENV['arireg_host']

View file

@ -1,5 +0,0 @@
class AddressVersion < PaperTrail::Version
include VersionSession
self.table_name = :log_addresses
self.sequence_name = :log_addresses_id_seq
end

View file

@ -1,13 +1,38 @@
class RegistrantPresenter class RegistrantPresenter
delegate :name, :ident, :email, :priv?, :street, :city, :id_code, :reg_no, to: :registrant delegate :name,
:ident,
:phone,
:email,
:priv?,
:id_code,
:reg_no,
:street, :city, :state, :zip, :country,
:ident_country,
:used?,
to: :registrant
def initialize(registrant:, view:) def initialize(registrant:, view:)
@registrant = registrant @registrant = registrant
@view = view @view = view
end end
def country def country(locale: I18n.locale)
registrant.country.translation(locale)
end
def ident_country(locale: I18n.locale)
registrant.ident_country.translation(locale)
end
def domain_names_with_roles(locale: I18n.locale, line_break: "\n")
lines = []
registrant.domain_names_with_roles.each do |domain_name, roles|
lines << "#{domain_name} (#{roles.map { |role| role.to_s.classify.constantize.model_name.human(locale: locale) }
.join(', ')})"
end
lines.join(line_break).html_safe
end end
private private

View file

@ -0,0 +1,19 @@
class RegistrantChange
def initialize(domain:, old_registrant:)
@domain = domain
@old_registrant = old_registrant
end
def confirm
notify_registrant
end
private
def notify_registrant
RegistrantChangeMailer.confirmed(domain: domain, old_registrant: old_registrant).deliver_now
end
attr_reader :domain
attr_reader :old_registrant
end

View file

@ -11,11 +11,11 @@
.col-md-3 .col-md-3
.form-group .form-group
= label_tag :registrant = label_tag :registrant
= f.search_field :registrant, value: params[:q][:registrant], class: 'form-control', placeholder: t(:registrant) = f.search_field :registrant, value: params[:q][:registrant], class: 'form-control', placeholder: t('.registrant_placeholder')
.col-md-3 .col-md-3
.form-group .form-group
= label_tag t(:registrar_name) = label_tag t(:registrar_name)
= f.search_field :registrar, value: params[:q][:registrar], class: 'form-control', placeholder: t(:registrant) = f.search_field :registrar, value: params[:q][:registrar], class: 'form-control', placeholder: t('.registrant')
.col-md-3 .col-md-3
.form-group .form-group
= label_tag :action = label_tag :action
@ -45,7 +45,7 @@
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
= t(:name) = t(:name)
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
= t(:registrant) = t('.registrant')
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
= t(:registrar_name) = t(:registrar_name)
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}

View file

@ -30,11 +30,11 @@
- domain_name = domain.name - domain_name = domain.name
%dd= link_to(domain_name, admin_domain_path(@version.item_id)) %dd= link_to(domain_name, admin_domain_path(@version.item_id))
%dt= t(:created) %dt= t('.created')
%dd %dd
= l(domain.created_at, format: :short) = l(domain.created_at, format: :short)
%dt= t(:updated) %dt= t('.updated')
%dd %dd
= l(domain.updated_at, format: :short) = l(domain.updated_at, format: :short)
@ -46,7 +46,7 @@
- domain.statuses.each do |s| - domain.statuses.each do |s|
= s = s
%dt= t(:registrant) %dt= t('.registrant')
%dd{class: changing_css_class(@version,"registrant_id")} %dd{class: changing_css_class(@version,"registrant_id")}
- registrant.each do |r| - registrant.each do |r|
- link = r.version_loader ? admin_contact_version_path(r.version_loader.try(:id)) : admin_contact_path(r.id) - link = r.version_loader ? admin_contact_version_path(r.version_loader.try(:id)) : admin_contact_path(r.id)
@ -57,7 +57,7 @@
= r[:code] = r[:code]
%br %br
%dt= t(:admin_contacts) %dt= t('.admin_contacts')
%dd %dd
- admin_contacts.each do |r| - admin_contacts.each do |r|
- link = r.version_loader ? admin_contact_version_path(r.version_loader.try(:id)) : admin_contact_path(r.id) - link = r.version_loader ? admin_contact_version_path(r.version_loader.try(:id)) : admin_contact_path(r.id)
@ -68,7 +68,7 @@
= r[:code] = r[:code]
%br %br
%dt= t(:tech_contacts) %dt= t('.tech_contacts')
%dd %dd
- tech_contacts.each do |r| - tech_contacts.each do |r|
- link = r.version_loader ? admin_contact_version_path(r.version_loader.try(:id)) : admin_contact_path(r.id) - link = r.version_loader ? admin_contact_version_path(r.version_loader.try(:id)) : admin_contact_path(r.id)

View file

@ -58,7 +58,7 @@
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
= sort_link(@q, 'name') = sort_link(@q, 'name')
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
= sort_link(@q, 'registrant_name', t(:registrant)) = sort_link(@q, 'registrant_name', t('.registrant'))
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
= sort_link(@q, 'valid_to', t(:valid_to)) = sort_link(@q, 'valid_to', t(:valid_to))
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}

View file

@ -1,7 +1,7 @@
- panel_class = @domain.errors.messages[:admin_contacts] ? 'panel-danger' : 'panel-default' - panel_class = @domain.errors.messages[:admin_contacts] ? 'panel-danger' : 'panel-default'
.panel{class: panel_class} .panel{class: panel_class}
.panel-heading.clearfix .panel-heading.clearfix
= t(:admin_contacts) = t('.title')
.table-responsive .table-responsive
%table.table.table-hover.table-bordered.table-condensed %table.table.table-hover.table-bordered.table-condensed
%thead %thead

View file

@ -1,6 +1,6 @@
.panel.panel-default .panel.panel-default
.panel-heading .panel-heading
%h3.panel-title= t(:registrant) %h3.panel-title= t('.title')
.panel-body .panel-body
%dl.dl-horizontal %dl.dl-horizontal
%dt= t(:name) %dt= t(:name)

View file

@ -1,7 +1,7 @@
- panel_class = @domain.errors.messages[:tech_contacts] ? 'panel-danger' : 'panel-default' - panel_class = @domain.errors.messages[:tech_contacts] ? 'panel-danger' : 'panel-default'
#tech_contacts.panel{class: panel_class} #tech_contacts.panel{class: panel_class}
.panel-heading.clearfix .panel-heading.clearfix
= t(:tech_contacts) = t('.title')
.table-responsive .table-responsive
%table.table.table-hover.table-bordered.table-condensed %table.table.table-hover.table-bordered.table-condensed
%thead %thead

View file

@ -11,9 +11,9 @@
%th{class: 'col-xs-1'}= t('.time') %th{class: 'col-xs-1'}= t('.time')
%th{class: 'col-xs-2'}= t(:statuses) %th{class: 'col-xs-2'}= t(:statuses)
%th{class: 'col-xs-1'}= t(:period) %th{class: 'col-xs-1'}= t(:period)
%th{class: 'col-xs-2'}= t(:registrant) %th{class: 'col-xs-2'}= t('.registrant')
%th{class: 'col-xs-2'}= t('.admin_contact') %th{class: 'col-xs-2'}= t('.admin_contact')
%th{class: 'col-xs-2'}= t(:tech) %th{class: 'col-xs-2'}= t('.tech_contact')
%th{class: 'col-xs-2'}= t(:nameservers) %th{class: 'col-xs-2'}= t(:nameservers)
%th{class: 'col-xs-2'}= t(:dnskeys) %th{class: 'col-xs-2'}= t(:dnskeys)
%th{class: 'col-xs-2'}= t(:registrar_name) %th{class: 'col-xs-2'}= t(:registrar_name)

View file

@ -1,55 +1,49 @@
Tere <%= @contact.name %> <%
contact = RegistrantPresenter.new(registrant: @contact, view: self)
registrar = RegistrarPresenter.new(registrar: @contact.registrar, view: self)
%>
Tere <%= contact.name %>
<br><br> <br><br>
Kontakti <%= @contact.name %> e-posti aadress on muudetud<br> Kontakti <%= contact.name %> e-posti aadress on muudetud<br>
endine aadress: <%= @old_email %><br> endine aadress: <%= @old_email %><br>
uus aadress: <%= @contact.email %> uus aadress: <%= contact.email %>
<br><br> <br><br>
E-posti aadressile saadetakse domeeni toimingutega seotud infot, sealhulgas kinnitustaotlused omanikuvahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja <%= @contact.registrar.name %> poole. E-posti aadressile saadetakse domeeni toimingutega seotud infot, sealhulgas kinnitustaotlused omanikuvahetuse ja domeeni kustutamise korral.
<br><br> <br><br>
<% if @contact.related_domain_descriptions.present? %> <% if contact.used? %>
Muudatusega seotud domeenid:<br> Muudatusega seotud domeenid:<br>
<% @contact.related_domain_descriptions.each do |domain, desc| %> <%= contact.domain_names_with_roles(locale: :et, line_break: '<br>') %>
<%= domain %> (<%= desc.map { |d| t(d, locale: :et) }.join(', ') %>)<br>
<% end %> <% end %>
<% end %> <br><br>
<br>
Kontaktandmed:<br> Kontaktandmed:<br>
Nimi: <%= @contact.name %><br> <%= render 'mailers/shared/registrant/registrant.et.html', registrant: contact, with_phone: true %>
Isikukood: <%= @contact.ident %><br> <br><br>
E-post: <%= @contact.email %><br> Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja poole:
Tel: <%= @contact.phone %><br> <%= render 'mailers/shared/registrar/registrar.et.html', registrar: registrar %>
Tänav: <%= @contact.street %><br>
Linn: <%= @contact.city %><br>
Riik: <%= @contact.country %>
<br><br> <br><br>
Lugupidamisega<br> Lugupidamisega<br>
Eesti Interneti Sihtasutus Eesti Interneti Sihtasutus
<br><br> <br><br>
<hr> <hr>
<br><br> <br><br>
Hi <%= @contact.name %> Hi <%= contact.name %>
<br><br> <br><br>
E-mail address of <%= @contact.name %> has been changed<br> E-mail address of <%= contact.name %> has been changed<br>
previous address: <%= @old_email %><br> previous address: <%= @old_email %><br>
new address: <%= @contact.email %> new address: <%= contact.email %>
<br><br> <br><br>
E-mail addresses are used to send important information regarding your registered domains including applications for approval of registrant change and domain deletion. Please make sure that the update and contact information are correct. Incase of problems please turn to your registrar. Your registrar is <%= @contact.registrar.name %> E-mail addresses are used to send important information regarding your registered domains including applications for approval of registrant change and domain deletion. Please make sure that the update and contact information are correct.
<br><br> <br><br>
<% if @contact.related_domain_descriptions.present? %> <% if contact.used? %>
Domains affected by this update:<br> Domains affected by this update:<br>
<% @contact.related_domain_descriptions.each do |domain, desc| %> <%= contact.domain_names_with_roles(line_break: '<br>') %>
<%= domain %> (<%= desc.map { |d| t(d, locale: :en) }.join(', ') %>)<br>
<% end %> <% end %>
<% end %> <br><br>
<br>
Contact information:<br> Contact information:<br>
Name: <%= @contact.name %><br> <%= render 'mailers/shared/registrant/registrant.en.html', registrant: contact, with_phone: true %>
Identity Code: <%= @contact.ident %><br> <br><br>
E-mail: <%= @contact.email %><br> In case of problems please turn to your registrar:
Tel: <%= @contact.phone %><br> <%= render 'mailers/shared/registrar/registrar.en.html', registrar: registrar %>
Street: <%= @contact.street %><br>
City: <%= @contact.city %><br>
Country: <%= @contact.country %>
<br><br> <br><br>
Best Regards,<br> Best Regards,<br>
Estonian Internet Foundation Estonian Internet Foundation

View file

@ -1,55 +1,49 @@
Tere <%= @contact.name %> <%
contact = RegistrantPresenter.new(registrant: @contact, view: self)
registrar = RegistrarPresenter.new(registrar: @contact.registrar, view: self)
%>
Tere <%= contact.name %>
Kontakti <%= @contact.name %> e-posti aadress on muudetud Kontakti <%= contact.name %> e-posti aadress on muudetud
endine aadress: <%= @old_email %> endine aadress: <%= @old_email %>
uus aadress: <%= @contact.email %> uus aadress: <%= contact.email %>
E-posti aadressile saadetakse domeeni toimingutega seotud infot, sealhulgas kinnitustaotlused omanikuvahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja <%= @contact.registrar.name %> poole. E-posti aadressile saadetakse domeeni toimingutega seotud infot, sealhulgas kinnitustaotlused omanikuvahetuse ja domeeni kustutamise korral.
<% if @contact.related_domain_descriptions.present? %> <% if contact.used? %>
Muudatusega seotud domeenid: Muudatusega seotud domeenid:
<% @contact.related_domain_descriptions.each do |domain, desc| %> <%= contact.domain_names_with_roles(locale: :et) %>
<%= domain %> (<%= desc.map { |d| t(d, locale: :et) }.join(', ') %>)
<% end %>
<% end %> <% end %>
Kontaktandmed: Kontaktandmed:
Nimi: <%= @contact.name %> <%= render 'mailers/shared/registrant/registrant.et.text', registrant: contact, with_phone: true %>
Isikukood: <%= @contact.ident %>
E-post: <%= @contact.email %> Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduge oma registripidaja poole:
Tel: <%= @contact.phone %> <%= render 'mailers/shared/registrar/registrar.et.text', registrar: registrar %>
Tänav: <%= @contact.street %>
Linn: <%= @contact.city %>
Riik: <%= @contact.country %>
Lugupidamisega Lugupidamisega
Eesti Interneti Sihtasutus Eesti Interneti Sihtasutus
---------------------------------------------------------------------------------- ----------------------------------------------------------------------------------
Hi <%= @contact.name %> Hi <%= contact.name %>
E-mail address of <%= @contact.name %> has been changed E-mail address of <%= contact.name %> has been changed
previous address: <%= @old_email %> previous address: <%= @old_email %>
new address: <%= @contact.email %> new address: <%= contact.email %>
E-mail addresses are used to send important information regarding your registered domains including applications for approval of registrant change and domain deletion. Please make sure that the update and contact information are correct. Incase of problems please turn to your registrar. Your registrar is <%= @contact.registrar.name %> E-mail addresses are used to send important information regarding your registered domains including applications for approval of registrant change and domain deletion. Please make sure that the update and contact information are correct.
<% if @contact.related_domain_descriptions.present? %> <% if contact.used? %>
Domains affected by this update: Domains affected by this update:
<% @contact.related_domain_descriptions.each do |domain, desc| %> <%= contact.domain_names_with_roles %>
<%= domain %> (<%= desc.map { |d| t(d, locale: :en) }.join(', ') %>)
<% end %>
<% end %> <% end %>
Contact information: Contact information:
Name: <%= @contact.name %> <%= render 'mailers/shared/registrant/registrant.en.text', registrant: contact, with_phone: true %>
Identity Code: <%= @contact.ident %>
E-mail: <%= @contact.email %> In case of problems please turn to your registrar:
Tel: <%= @contact.phone %> <%= render 'mailers/shared/registrar/registrar.en.text', registrar: registrar %>
Street: <%= @contact.street %>
City: <%= @contact.city %>
Country: <%= @contact.country %>
Best Regards, Best Regards,
Estonian Internet Foundation Estonian Internet Foundation

View file

@ -1,43 +0,0 @@
Tere
<br><br>
Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
<br><br>
Uue registreerija andmed:<br>
Nimi: <%= @new_registrant.name %><br>
<% if @new_registrant.priv? %>
Isikukood: <%= @new_registrant.ident %><br>
<% else %>
Äriregistrikood: <%= @new_registrant.ident %><br>
<% end %>
Epost: <%= @new_registrant.email %><br>
<% if @address_processing -%>
Tänav: <%= @new_registrant.street %><br>
Linn: <%= @new_registrant.city %><br>
Riik: <%= @new_registrant.country.name %>
<% end -%>
<br><br>
Lugupidamisega<br>
Eesti Interneti Sihtasutus
<br><br>
<hr>
<br><br>
Hi,
<br><br>
Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated.
<br><br>
New registrant:<br>
Name: <%= @new_registrant.name %><br>
<% if @new_registrant.priv? %>
Personal code: <%= @new_registrant.ident %><br>
<% else %>
Business Registry code: <%= @new_registrant.ident %><br>
<% end %>
E-mail: <%= @new_registrant.email %><br>
<% if @address_processing -%>
Street: <%= @new_registrant.street %><br>
City: <%= @new_registrant.city %><br>
Country: <%= @new_registrant.country.name %>
<% end -%>
<br><br>
Best Regards,<br>
Estonian Internet Foundation

View file

@ -1,45 +0,0 @@
Tere
Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
Uue registreerija andmed:
Nimi: <%= @new_registrant.name %>
<% if @new_registrant.priv? %>
Isikukood: <%= @new_registrant.ident %>
<% else %>
Äriregistrikood: <%= @new_registrant.ident %>
<% end %>
Epost: <%= @new_registrant.email %>
<% if @address_processing -%>
Tänav: <%= @new_registrant.street %>
Linn: <%= @new_registrant.city %>
Riik: <%= @new_registrant.country.name %>
<% end -%>
Lugupidamisega
Eesti Interneti Sihtasutus
--------------------------------------
Hi,
Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated.
New registrant:
Name: <%= @new_registrant.name %>
<% if @new_registrant.priv? %>
Personal code: <%= @new_registrant.ident %>
<% else %>
Business Registry code: <%= @new_registrant.ident %>
<% end %>
E-mail: <%= @new_registrant.email %>
<% if @address_processing -%>
Street: <%= @new_registrant.street %>
City: <%= @new_registrant.city %>
Country: <%= @new_registrant.country.name %>
<% end -%>
Best Regards,
Estonian Internet Foundation

View file

@ -1,43 +0,0 @@
Tere
<br><br>
Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
<br><br>
Uue registreerija andmed:<br>
Nimi: <%= @new_registrant.name %><br>
<% if @new_registrant.priv? %>
Isikukood: <%= @new_registrant.ident %><br>
<% else %>
Äriregistrikood: <%= @new_registrant.ident %><br>
<% end %>
Epost: <%= @new_registrant.email %><br>
<% if @address_processing -%>
Tänav: <%= @new_registrant.street %><br>
Linn: <%= @new_registrant.city %><br>
Riik: <%= @new_registrant.country.name %>
<% end -%>
<br><br>
Lugupidamisega<br>
Eesti Interneti Sihtasutus
<br><br>
<hr>
<br><br>
Hi,
<br><br>
Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated.
<br><br>
New registrant:<br>
Name: <%= @new_registrant.name %><br>
<% if @new_registrant.priv? %>
Personal code: <%= @new_registrant.ident %><br>
<% else %>
Business Registry code: <%= @new_registrant.ident %><br>
<% end %>
E-mail: <%= @new_registrant.email %><br>
<% if @address_processing -%>
Street: <%= @new_registrant.street %><br>
City: <%= @new_registrant.city %><br>
Country: <%= @new_registrant.country.name %>
<% end -%>
<br><br>
Best Regards,<br>
Estonian Internet Foundation

View file

@ -1,45 +0,0 @@
Tere
Domeeni <%= @domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
Uue registreerija andmed:
Nimi: <%= @new_registrant.name %>
<% if @new_registrant.priv? %>
Isikukood: <%= @new_registrant.ident %>
<% else %>
Äriregistrikood: <%= @new_registrant.ident %>
<% end %>
Epost: <%= @new_registrant.email %>
<% if @address_processing -%>
Tänav: <%= @new_registrant.street %>
Linn: <%= @new_registrant.city %>
Riik: <%= @new_registrant.country.name %>
<% end -%>
Lugupidamisega
Eesti Interneti Sihtasutus
--------------------------------------
Hi,
Process for changing registrant of the domain <%= @domain.name %> has been approved and the data in the registry is updated.
New registrant:
Name: <%= @new_registrant.name %>
<% if @new_registrant.priv? %>
Personal code: <%= @new_registrant.ident %>
<% else %>
Business Registry code: <%= @new_registrant.ident %>
<% end %>
E-mail: <%= @new_registrant.email %>
<% if @address_processing -%>
Street: <%= @new_registrant.street %>
City: <%= @new_registrant.city %>
Country: <%= @new_registrant.country.name %>
<% end -%>
Best Regards,
Estonian Internet Foundation

View file

@ -0,0 +1,25 @@
<%
domain = DomainPresenter.new(domain: @domain, view: self)
new_registrant = RegistrantPresenter.new(registrant: @domain.registrant, view: self)
%>
Tere
<br><br>
Domeeni <%= domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
<br><br>
Uue registreerija andmed:<br>
<%= render 'mailers/shared/registrant/registrant.et.html', registrant: new_registrant %>
<br><br>
Lugupidamisega<br>
Eesti Interneti Sihtasutus
<br><br>
<hr>
<br><br>
Hi,
<br><br>
Process for changing registrant of the domain <%= domain.name %> has been approved and the data in the registry is updated.
<br><br>
New registrant:<br>
<%= render 'mailers/shared/registrant/registrant.en.html', registrant: new_registrant %>
<br><br>
Best Regards,<br>
Estonian Internet Foundation

View file

@ -0,0 +1,25 @@
<%
domain = DomainPresenter.new(domain: @domain, view: self)
new_registrant = RegistrantPresenter.new(registrant: @domain.registrant, view: self)
%>
Tere
Domeeni <%= domain.name %> registreerija vahetuse taotlus on kinnitatud ning andmed registris uuendatud.
Uue registreerija andmed:
<%= render 'mailers/shared/registrant/registrant.et.text', registrant: new_registrant %>
Lugupidamisega
Eesti Interneti Sihtasutus
--------------------------------------
Hi,
Process for changing registrant of the domain <%= domain.name %> has been approved and the data in the registry is updated.
New registrant:
<%= render 'mailers/shared/registrant/registrant.en.text', registrant: new_registrant %>
Best Regards,
Estonian Internet Foundation

View file

@ -4,6 +4,15 @@ Name: <%= registrant.name %><br>
<% else %> <% else %>
Business Registry code: <%= registrant.ident %><br> Business Registry code: <%= registrant.ident %><br>
<% end %> <% end %>
<% if local_assigns[:with_phone] -%>
Phone: <%= registrant.phone %><br>
<% end -%>
<% if address_processing -%>
Street: <%= registrant.street %><br> Street: <%= registrant.street %><br>
City: <%= registrant.city %><br> City: <%= registrant.city %><br>
State: <%= registrant.state %><br>
Zip-code: <%= registrant.zip %><br>
Country: <%= registrant.country %> Country: <%= registrant.country %>
<% else %>
Country: <%= registrant.ident_country %>
<% end -%>

View file

@ -4,6 +4,15 @@ Name: <%= registrant.name %>
<% else %> <% else %>
Business Registry code: <%= registrant.ident %> Business Registry code: <%= registrant.ident %>
<% end %> <% end %>
<% if local_assigns[:with_phone] -%>
Phone: <%= registrant.phone %>
<% end -%>
<% if address_processing -%>
Street: <%= registrant.street %> Street: <%= registrant.street %>
City: <%= registrant.city %> City: <%= registrant.city %>
State: <%= registrant.state %>
Zip-code: <%= registrant.zip %>
Country: <%= registrant.country %> Country: <%= registrant.country %>
<% else %>
Country: <%= registrant.ident_country %>
<% end -%>

View file

@ -4,6 +4,15 @@ Nimi: <%= registrant.name %><br>
<% else %> <% else %>
Äriregistrikood: <%= registrant.ident %><br> Äriregistrikood: <%= registrant.ident %><br>
<% end %> <% end %>
<% if local_assigns[:with_phone] -%>
Telefon: <%= registrant.phone %><br>
<% end -%>
<% if address_processing -%>
Tänav: <%= registrant.street %><br> Tänav: <%= registrant.street %><br>
Linn: <%= registrant.city %><br> Linn: <%= registrant.city %><br>
Riik: <%= registrant.country %> Maakond: <%= registrant.state %><br>
Sihtnumber: <%= registrant.zip %><br>
Riik: <%= registrant.country(locale: :et) %>
<% else %>
Riik: <%= registrant.ident_country(locale: :et) %>
<% end -%>

View file

@ -4,6 +4,15 @@ Nimi: <%= registrant.name %>
<% else %> <% else %>
Äriregistrikood: <%= registrant.ident %> Äriregistrikood: <%= registrant.ident %>
<% end %> <% end %>
<% if local_assigns[:with_phone] -%>
Telefon: <%= registrant.phone %>
<% end -%>
<% if address_processing -%>
Tänav: <%= registrant.street %> Tänav: <%= registrant.street %>
Linn: <%= registrant.city %> Linn: <%= registrant.city %>
Riik: <%= registrant.country %> Maakond: <%= registrant.state %>
Sihtnumber: <%= registrant.zip %>
Riik: <%= registrant.country(locale: :et) %>
<% else %>
Riik: <%= registrant.ident_country(locale: :et) %>
<% end -%>

View file

@ -26,7 +26,7 @@
.col-md-12.text-center.confirmation .col-md-12.text-center.confirmation
.column-keys .column-keys
%p= t(:domain_name) + ':' %p= t(:domain_name) + ':'
%p= t(:registrant) + ':' %p= t('.registrant') + ':'
.column-values .column-values
%p= @domain.name %p= @domain.name
%p= "#{@domain.registrant_name} (#{@domain.registrant.ident})" %p= "#{@domain.registrant_name} (#{@domain.registrant.ident})"

View file

@ -12,7 +12,7 @@
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
=t(:name) =t(:name)
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
=t(:registrant) =t('.registrant')
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
=t(:valid_to) =t(:valid_to)
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}

View file

@ -57,7 +57,7 @@
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
= sort_link(@q, 'name') = sort_link(@q, 'name')
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
= sort_link(@q, 'registrant_name', t(:registrant)) = sort_link(@q, 'registrant_name', t('.registrant'))
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
= sort_link(@q, 'valid_to', t(:valid_to)) = sort_link(@q, 'valid_to', t(:valid_to))
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}

View file

@ -1,7 +1,7 @@
- panel_class = @domain.errors.messages[:admin_contacts] ? 'panel-danger' : 'panel-default' - panel_class = @domain.errors.messages[:admin_contacts] ? 'panel-danger' : 'panel-default'
.panel{class: panel_class} .panel{class: panel_class}
.panel-heading.clearfix .panel-heading.clearfix
= t(:admin_contacts) = t('.title')
.table-responsive .table-responsive
%table.table.table-hover.table-bordered.table-condensed %table.table.table-hover.table-bordered.table-condensed
%thead %thead

View file

@ -1,6 +1,6 @@
.panel.panel-default .panel.panel-default
.panel-heading .panel-heading
%h3.panel-title= t(:registrant) %h3.panel-title= t('.title')
.panel-body .panel-body
%dl.dl-horizontal %dl.dl-horizontal
%dt= t(:name) %dt= t(:name)

View file

@ -1,7 +1,7 @@
- panel_class = @domain.errors.messages[:tech_contacts] ? 'panel-danger' : 'panel-default' - panel_class = @domain.errors.messages[:tech_contacts] ? 'panel-danger' : 'panel-default'
#tech_contacts.panel{class: panel_class} #tech_contacts.panel{class: panel_class}
.panel-heading.clearfix .panel-heading.clearfix
= t(:tech_contacts) = t('.title')
.table-responsive .table-responsive
%table.table.table-hover.table-bordered.table-condensed %table.table.table-hover.table-bordered.table-condensed
%thead %thead

View file

@ -18,7 +18,7 @@
.form-group .form-group
.col-md-3.control-label .col-md-3.control-label
= label_tag :domain_registrant, t(:registrant), class: 'required' = label_tag :domain_registrant, t('.registrant'), class: 'required'
.col-md-7 .col-md-7
= text_field_tag 'domain[registrant]', @domain_params[:registrant], class: "hidden" = text_field_tag 'domain[registrant]', @domain_params[:registrant], class: "hidden"
= text_field_tag 'domain[registrant_helper]', contacts.find_by(code: @domain_params[:registrant]).try(:search_name), = text_field_tag 'domain[registrant_helper]', contacts.find_by(code: @domain_params[:registrant]).try(:search_name),

View file

@ -67,7 +67,7 @@
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
= sort_link(@q, 'name') = sort_link(@q, 'name')
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
= sort_link(@q, 'registrant_name', t(:registrant)) = sort_link(@q, 'registrant_name', t('.registrant'))
%th{class: 'col-xs-2'} %th{class: 'col-xs-2'}
= sort_link(@q, 'valid_to', t(:valid_to)) = sort_link(@q, 'valid_to', t(:valid_to))
%th{class: 'col-xs-2'}= t('actions') %th{class: 'col-xs-2'}= t('actions')

View file

@ -11,7 +11,7 @@
%dd= @data.css('clID').text %dd= @data.css('clID').text
- registrant = Contact.find_by_code(@data.css('registrant').text) - registrant = Contact.find_by_code(@data.css('registrant').text)
%dt= t(:registrant) %dt= t('.registrant')
%dd= "#{registrant.name} (#{@data.css('registrant').text})" %dd= "#{registrant.name} (#{@data.css('registrant').text})"
%dt= t('.registered') %dt= t('.registered')

View file

@ -92,7 +92,6 @@ restful_whois_url: 'https://restful-whois.example.com'
# #
# Estonian Business Registry # Estonian Business Registry
# #
# config/secrets.yml --- arireg: {username, password}
arireg_username: 'kasutaja' arireg_username: 'kasutaja'
arireg_password: 'parool' arireg_password: 'parool'
# config/environments/production.rb --- Soap::Arireg.wsdl, Soap::Arireg.host # config/environments/production.rb --- Soap::Arireg.wsdl, Soap::Arireg.host

View file

@ -80,6 +80,7 @@ module Registry
} }
config.action_view.default_form_builder = 'DefaultFormBuilder' config.action_view.default_form_builder = 'DefaultFormBuilder'
config.secret_key_base = Figaro.env.secret_key_base
end end
end end

View file

@ -1 +0,0 @@
Registry::Application.config.secret_token = ENV['secret_key_base']

View file

@ -3,3 +3,12 @@ en:
domain_versions: domain_versions:
archive: archive:
reset_btn: Reset reset_btn: Reset
registrant_placeholder: Registrant
registrant: Registrant
show:
created: Created
updated: Updated
registrant: Registrant
admin_contacts: Admin. contacts
tech_contacts: Tech. contacts

View file

@ -3,6 +3,7 @@ en:
domains: domains:
index: index:
reset_btn: Reset reset_btn: Reset
registrant: Registrant
edit: edit:
add_new_status_btn: Add new status add_new_status_btn: Add new status
@ -22,7 +23,9 @@ en:
versions: versions:
time: Time time: Time
admin_contact: Admin contact registrant: Registrant
admin_contact: Admin. contact
tech_contact: Tech. contact
partials: partials:
general: general:
@ -30,6 +33,15 @@ en:
delete_time: Delete time delete_time: Delete time
force_delete_time: Force delete time force_delete_time: Force delete time
admin_contacts:
title: Admin. contacts
tech_contacts:
title: Tech. contacts
owner:
title: Registrant
force_delete_toggle_btn: force_delete_toggle_btn:
schedule: Schedule force delete schedule: Schedule force delete
cancel: Cancel force delete cancel: Cancel force delete

View file

@ -1,5 +1,10 @@
en: en:
activerecord: activerecord:
models:
# Used in ContactMailer
registrant: Registrant
admin_domain_contact: Administrative contact
tech_domain_contact: Technical contact
errors: errors:
models: models:
contact: contact:

View file

@ -0,0 +1,7 @@
et:
activerecord:
models:
# Used in ContactMailer
registrant: Registreerija
admin_domain_contact: Halduskontakt
tech_domain_contact: Tehniline kontakt

View file

@ -285,8 +285,6 @@ en:
valid_from: 'Valid from' valid_from: 'Valid from'
general: 'General' general: 'General'
contacts: 'Contacts' contacts: 'Contacts'
tech_contacts: 'Technical contacts'
admin_contacts: 'Admin contacts'
identity_code: 'Identity code' identity_code: 'Identity code'
nameservers: 'Nameservers' nameservers: 'Nameservers'
hostname: 'Hostname' hostname: 'Hostname'
@ -319,7 +317,6 @@ en:
failed_to_update_status: 'Failed to update status!' failed_to_update_status: 'Failed to update status!'
status_deleted: 'Status deleted!' status_deleted: 'Status deleted!'
failed_to_delete_status: 'Failed to delete status!' failed_to_delete_status: 'Failed to delete status!'
tech_contact: 'Tech contact'
new_domain_contact: 'New contact' new_domain_contact: 'New contact'
domain_status_prohibits_deleting: 'Domain status prohibits deleting' domain_status_prohibits_deleting: 'Domain status prohibits deleting'
domain_deleted: 'Domain deleted!' domain_deleted: 'Domain deleted!'
@ -553,11 +550,9 @@ en:
info: 'Info' info: 'Info'
register: 'Register' register: 'Register'
send_epp_request: 'Send EPP Request' send_epp_request: 'Send EPP Request'
registrant: 'Registrant'
created_at: 'Created at' created_at: 'Created at'
valid_to: 'Valid to' valid_to: 'Valid to'
updated_at: 'Updated at' updated_at: 'Updated at'
tech_contacts: 'Tech contacts'
name: 'Name' name: 'Name'
type: 'Type' type: 'Type'
code: 'Code' code: 'Code'
@ -760,8 +755,6 @@ en:
unimplemented_object_service: 'Unimplemented object service' unimplemented_object_service: 'Unimplemented object service'
contact_email_update_subject: 'Teie domeenide kontakt epostiaadress on muutunud / Contact e-mail addresses of your domains have changed' contact_email_update_subject: 'Teie domeenide kontakt epostiaadress on muutunud / Contact e-mail addresses of your domains have changed'
object_status_prohibits_operation: 'Object status prohibits operation' object_status_prohibits_operation: 'Object status prohibits operation'
registrant_updated_notification_for_new_registrant_subject: 'Domeeni %{name} registreerija vahetus teostatud / Registrant change of %{name} has been finished.'
registrant_updated_notification_for_old_registrant_subject: 'Domeeni %{name} registreerija vahetus teostatud / Registrant change of %{name} has been finished.'
pending_delete_rejected_notification_subject: "Domeeni %{name} kustutamise taotlus tagasi lükatud / %{name} deletion declined" pending_delete_rejected_notification_subject: "Domeeni %{name} kustutamise taotlus tagasi lükatud / %{name} deletion declined"
pending_delete_expired_notification_subject: "Domeeni %{name} kustutamise taotlus on tühistatud / %{name} deletion cancelled" pending_delete_expired_notification_subject: "Domeeni %{name} kustutamise taotlus on tühistatud / %{name} deletion cancelled"
delete_confirmation_subject: "Domeeni %{name} kustutatud / %{name} deleted" delete_confirmation_subject: "Domeeni %{name} kustutatud / %{name} deleted"

View file

@ -2,6 +2,3 @@ et:
username: 'Kasutajanimi' username: 'Kasutajanimi'
password: 'Parool' password: 'Parool'
log_in: 'Logi sisse' log_in: 'Logi sisse'
registrant: registreerija
tech: tehniline kontakt
admin: halduskontakt

View file

@ -6,5 +6,9 @@ en:
subject: Domeeni %{domain_name} registreerija vahetus protseduur on algatatud / %{domain_name} registrant change subject: Domeeni %{domain_name} registreerija vahetus protseduur on algatatud / %{domain_name} registrant change
rejected: rejected:
subject: Domeeni %{domain_name} registreerija vahetuse taotlus tagasi lükatud / %{domain_name} registrant change declined subject: Domeeni %{domain_name} registreerija vahetuse taotlus tagasi lükatud / %{domain_name} registrant change declined
confirmed:
subject: >-
Domeeni %{domain_name} registreerija vahetus teostatud
/ Registrant change of %{domain_name} has been finished
expired: expired:
subject: Domeeni %{domain_name} registreerija vahetuse taotlus on tühistatud / %{domain_name} registrant change cancelled subject: Domeeni %{domain_name} registreerija vahetuse taotlus on tühistatud / %{domain_name} registrant change cancelled

View file

@ -0,0 +1,5 @@
en:
registrant:
domain_delete_confirms:
show:
registrant: Registrant

View file

@ -0,0 +1,17 @@
en:
registrant:
domains:
index:
registrant: Registrant
download_list:
registrant: Registrant
partials:
owner:
title: Registrant
admin_contacts:
title: Admin. contacts
tech_contacts:
title: Tech. contacts

View file

@ -2,6 +2,7 @@ en:
registrar: registrar:
domains: domains:
index: index:
registrant: Registrant
download_btn: Download download_btn: Download
csv: csv:
domain_name: Domain domain_name: Domain
@ -15,8 +16,12 @@ en:
flags: Flags flags: Flags
alg: Algorithm alg: Algorithm
general:
registrant: Registrant
partials: partials:
general: general:
registrant: Registrant
registered: Registered registered: Registered
created: Created created: Created
updated: Updated updated: Updated

View file

@ -1,14 +0,0 @@
development:
secret_key_base: generate-your-secret-key-by-rake-secret
test:
secret_key_base: generate-your-secret-key-by-rake-secret
alpha:
secret_key_base: generate-your-secret-key-by-rake-secret
staging:
secret_key_base: generate-your-secret-key-by-rake-secret
production:
secret_key_base: generate-your-secret-key-by-rake-secret

View file

@ -0,0 +1,6 @@
class RemoveAddressesWithVersions < ActiveRecord::Migration
def change
drop_table :addresses
drop_table :log_addresses
end
end

View file

@ -0,0 +1,6 @@
class AddForeignKeyConstraintsToDomains < ActiveRecord::Migration
def change
add_foreign_key :domains, :registrars, name: 'domains_registrar_id_fk'
add_foreign_key :domains, :contacts, column: :registrant_id, name: 'domains_registrant_id_fk'
end
end

View file

@ -0,0 +1,6 @@
class ChangeDomainRegistrarAndRegistrantToNotNull < ActiveRecord::Migration
def change
change_column :domains, :registrar_id, :integer, null: false
change_column :domains, :registrant_id, :integer, null: false
end
end

View file

@ -0,0 +1,6 @@
class ImproveContactRegistrarId < ActiveRecord::Migration
def change
add_foreign_key :contacts, :registrars, name: 'contacts_registrar_id_fk'
change_column :contacts, :registrar_id, :integer, null: false
end
end

View file

@ -357,47 +357,6 @@ CREATE SEQUENCE accounts_id_seq
ALTER SEQUENCE accounts_id_seq OWNED BY accounts.id; ALTER SEQUENCE accounts_id_seq OWNED BY accounts.id;
--
-- Name: addresses; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE addresses (
id integer NOT NULL,
contact_id integer,
city character varying,
street character varying,
zip character varying,
created_at timestamp without time zone,
updated_at timestamp without time zone,
street2 character varying,
street3 character varying,
creator_str character varying,
updator_str character varying,
country_code character varying,
state character varying,
legacy_contact_id integer
);
--
-- Name: addresses_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE addresses_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: addresses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE addresses_id_seq OWNED BY addresses.id;
-- --
-- Name: api_users; Type: TABLE; Schema: public; Owner: -; Tablespace: -- Name: api_users; Type: TABLE; Schema: public; Owner: -; Tablespace:
-- --
@ -734,7 +693,7 @@ CREATE TABLE contacts (
auth_info character varying, auth_info character varying,
name character varying, name character varying,
org_name character varying, org_name character varying,
registrar_id integer, registrar_id integer NOT NULL,
creator_str character varying, creator_str character varying,
updator_str character varying, updator_str character varying,
ident_country_code character varying, ident_country_code character varying,
@ -1074,12 +1033,12 @@ ALTER SEQUENCE domain_transfers_id_seq OWNED BY domain_transfers.id;
CREATE TABLE domains ( CREATE TABLE domains (
id integer NOT NULL, id integer NOT NULL,
name character varying, name character varying,
registrar_id integer, registrar_id integer NOT NULL,
registered_at timestamp without time zone, registered_at timestamp without time zone,
status character varying, status character varying,
valid_from timestamp without time zone, valid_from timestamp without time zone,
valid_to timestamp without time zone, valid_to timestamp without time zone,
registrant_id integer, registrant_id integer NOT NULL,
auth_info character varying, auth_info character varying,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
@ -1421,44 +1380,6 @@ CREATE SEQUENCE log_accounts_id_seq
ALTER SEQUENCE log_accounts_id_seq OWNED BY log_accounts.id; ALTER SEQUENCE log_accounts_id_seq OWNED BY log_accounts.id;
--
-- Name: log_addresses; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE log_addresses (
id integer NOT NULL,
item_type character varying NOT NULL,
item_id integer NOT NULL,
event character varying NOT NULL,
whodunnit character varying,
object json,
object_changes json,
created_at timestamp without time zone,
session character varying,
children json,
uuid character varying
);
--
-- Name: log_addresses_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE log_addresses_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: log_addresses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE log_addresses_id_seq OWNED BY log_addresses.id;
-- --
-- Name: log_api_users; Type: TABLE; Schema: public; Owner: -; Tablespace: -- Name: log_api_users; Type: TABLE; Schema: public; Owner: -; Tablespace:
-- --
@ -2985,13 +2906,6 @@ ALTER TABLE ONLY account_activities ALTER COLUMN id SET DEFAULT nextval('account
ALTER TABLE ONLY accounts ALTER COLUMN id SET DEFAULT nextval('accounts_id_seq'::regclass); ALTER TABLE ONLY accounts ALTER COLUMN id SET DEFAULT nextval('accounts_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY addresses ALTER COLUMN id SET DEFAULT nextval('addresses_id_seq'::regclass);
-- --
-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- Name: id; Type: DEFAULT; Schema: public; Owner: -
-- --
@ -3167,13 +3081,6 @@ ALTER TABLE ONLY log_account_activities ALTER COLUMN id SET DEFAULT nextval('log
ALTER TABLE ONLY log_accounts ALTER COLUMN id SET DEFAULT nextval('log_accounts_id_seq'::regclass); ALTER TABLE ONLY log_accounts ALTER COLUMN id SET DEFAULT nextval('log_accounts_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY log_addresses ALTER COLUMN id SET DEFAULT nextval('log_addresses_id_seq'::regclass);
-- --
-- Name: id; Type: DEFAULT; Schema: public; Owner: - -- Name: id; Type: DEFAULT; Schema: public; Owner: -
-- --
@ -3463,14 +3370,6 @@ ALTER TABLE ONLY accounts
ADD CONSTRAINT accounts_pkey PRIMARY KEY (id); ADD CONSTRAINT accounts_pkey PRIMARY KEY (id);
--
-- Name: addresses_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY addresses
ADD CONSTRAINT addresses_pkey PRIMARY KEY (id);
-- --
-- Name: api_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- Name: api_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
-- --
@ -3671,14 +3570,6 @@ ALTER TABLE ONLY log_accounts
ADD CONSTRAINT log_accounts_pkey PRIMARY KEY (id); ADD CONSTRAINT log_accounts_pkey PRIMARY KEY (id);
--
-- Name: log_addresses_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY log_addresses
ADD CONSTRAINT log_addresses_pkey PRIMARY KEY (id);
-- --
-- Name: log_api_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- Name: log_api_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
-- --
@ -4307,20 +4198,6 @@ CREATE INDEX index_log_accounts_on_item_type_and_item_id ON log_accounts USING b
CREATE INDEX index_log_accounts_on_whodunnit ON log_accounts USING btree (whodunnit); CREATE INDEX index_log_accounts_on_whodunnit ON log_accounts USING btree (whodunnit);
--
-- Name: index_log_addresses_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_log_addresses_on_item_type_and_item_id ON log_addresses USING btree (item_type, item_id);
--
-- Name: index_log_addresses_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX index_log_addresses_on_whodunnit ON log_addresses USING btree (whodunnit);
-- --
-- Name: index_log_api_users_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace: -- Name: index_log_api_users_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
-- --
@ -4769,6 +4646,30 @@ CREATE UNIQUE INDEX unique_data_migrations ON data_migrations USING btree (versi
CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version); CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
--
-- Name: contacts_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY contacts
ADD CONSTRAINT contacts_registrar_id_fk FOREIGN KEY (registrar_id) REFERENCES registrars(id);
--
-- Name: domains_registrant_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY domains
ADD CONSTRAINT domains_registrant_id_fk FOREIGN KEY (registrant_id) REFERENCES contacts(id);
--
-- Name: domains_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY domains
ADD CONSTRAINT domains_registrar_id_fk FOREIGN KEY (registrar_id) REFERENCES registrars(id);
-- --
-- Name: fk_rails_78c376257f; Type: FK CONSTRAINT; Schema: public; Owner: - -- Name: fk_rails_78c376257f; Type: FK CONSTRAINT; Schema: public; Owner: -
-- --
@ -5257,3 +5158,11 @@ INSERT INTO schema_migrations (version) VALUES ('20170423225333');
INSERT INTO schema_migrations (version) VALUES ('20170424115801'); INSERT INTO schema_migrations (version) VALUES ('20170424115801');
INSERT INTO schema_migrations (version) VALUES ('20170509215614');
INSERT INTO schema_migrations (version) VALUES ('20170606133501');
INSERT INTO schema_migrations (version) VALUES ('20170606150352');
INSERT INTO schema_migrations (version) VALUES ('20170606202859');

View file

@ -216,17 +216,6 @@
<ellipse fill="none" stroke="#012c8d" cx="579.023" cy="-73.4182" rx="4.00001" ry="4.00001"/> <ellipse fill="none" stroke="#012c8d" cx="579.023" cy="-73.4182" rx="4.00001" ry="4.00001"/>
<polygon fill="#012c8d" stroke="#012c8d" points="1479.02,-19.5188 1489.05,-23.9393 1484.02,-19.4791 1489.02,-19.4394 1489.02,-19.4394 1489.02,-19.4394 1484.02,-19.4791 1488.98,-14.9396 1479.02,-19.5188 1479.02,-19.5188"/> <polygon fill="#012c8d" stroke="#012c8d" points="1479.02,-19.5188 1489.05,-23.9393 1484.02,-19.4791 1489.02,-19.4394 1489.02,-19.4394 1489.02,-19.4394 1484.02,-19.4791 1488.98,-14.9396 1479.02,-19.5188 1479.02,-19.5188"/>
</g> </g>
<!-- AddressVersion -->
<g id="node20" class="node"><title>AddressVersion</title>
<ellipse fill="none" stroke="black" cx="3260.99" cy="-91" rx="67.6881" ry="18"/>
<text text-anchor="middle" x="3260.99" y="-87.3" font-family="Times,serif" font-size="14.00">AddressVersion</text>
</g>
<!-- AddressVersion&#45;&gt;VersionAssociation -->
<g id="edge18" class="edge"><title>AddressVersion&#45;&gt;VersionAssociation</title>
<path fill="none" stroke="#9f7cb6" d="M3205.28,-76.4424C3198.15,-75.0787 3190.93,-73.8762 3183.99,-73 2939.13,-42.0435 2875.67,-62.2947 2628.99,-54 2268.68,-41.8838 1839.45,-27.8273 1657.5,-21.8862"/>
<ellipse fill="none" stroke="#9f7cb6" cx="3209.66" cy="-77.3209" rx="4.00001" ry="4.00001"/>
<polygon fill="#9f7cb6" stroke="#9f7cb6" points="1657.45,-21.8844 1647.6,-17.0604 1652.45,-21.7212 1647.45,-21.558 1647.45,-21.558 1647.45,-21.558 1652.45,-21.7212 1647.31,-26.0556 1657.45,-21.8844 1657.45,-21.8844"/>
</g>
<!-- BankStatementVersion --> <!-- BankStatementVersion -->
<g id="node21" class="node"><title>BankStatementVersion</title> <g id="node21" class="node"><title>BankStatementVersion</title>
<ellipse fill="none" stroke="black" cx="612.994" cy="-253" rx="92.8835" ry="18"/> <ellipse fill="none" stroke="black" cx="612.994" cy="-253" rx="92.8835" ry="18"/>
@ -1442,18 +1431,6 @@
<polygon fill="#8b10e0" stroke="#8b10e0" points="832.955,-334.569 833.988,-323.652 831.341,-329.837 829.728,-325.104 829.728,-325.104 829.728,-325.104 831.341,-329.837 825.469,-326.556 832.955,-334.569 832.955,-334.569"/> <polygon fill="#8b10e0" stroke="#8b10e0" points="832.955,-334.569 833.988,-323.652 831.341,-329.837 829.728,-325.104 829.728,-325.104 829.728,-325.104 831.341,-329.837 825.469,-326.556 832.955,-334.569 832.955,-334.569"/>
<text text-anchor="middle" x="860.994" y="-357.3" font-family="Times,serif" font-size="14.00">versions</text> <text text-anchor="middle" x="860.994" y="-357.3" font-family="Times,serif" font-size="14.00">versions</text>
</g> </g>
<!-- Address -->
<g id="node68" class="node"><title>Address</title>
<ellipse fill="none" stroke="black" cx="3518.99" cy="-199" rx="39.7935" ry="18"/>
<text text-anchor="middle" x="3518.99" y="-195.3" font-family="Times,serif" font-size="14.00">Address</text>
</g>
<!-- Address&#45;&gt;AddressVersion -->
<g id="edge174" class="edge"><title>Address&#45;&gt;AddressVersion</title>
<path fill="none" stroke="#3b7ce0" d="M3500.25,-175.77C3485.34,-159.618 3463.05,-138.63 3438.99,-127 3397.55,-106.966 3382.13,-118.027 3336.99,-109 3331.61,-107.923 3326.02,-106.76 3320.42,-105.565"/>
<ellipse fill="none" stroke="#3b7ce0" cx="3503.1" cy="-178.941" rx="4.00002" ry="4.00002"/>
<polygon fill="#3b7ce0" stroke="#3b7ce0" points="3320.17,-105.509 3311.35,-98.9929 3315.28,-104.45 3310.39,-103.391 3310.39,-103.391 3310.39,-103.391 3315.28,-104.45 3309.44,-107.789 3320.17,-105.509 3320.17,-105.509"/>
<text text-anchor="middle" x="3509.99" y="-141.3" font-family="Times,serif" font-size="14.00">versions</text>
</g>
<!-- LegalDocument&#45;&gt;LegalDocumentVersion --> <!-- LegalDocument&#45;&gt;LegalDocumentVersion -->
<g id="edge177" class="edge"><title>LegalDocument&#45;&gt;LegalDocumentVersion</title> <g id="edge177" class="edge"><title>LegalDocument&#45;&gt;LegalDocumentVersion</title>
<path fill="none" stroke="#1c3760" d="M2444.6,-196.382C2359.77,-193.481 2228.05,-185.408 2183.99,-163 2163.9,-152.78 2147.11,-133.415 2135.78,-117.487"/> <path fill="none" stroke="#1c3760" d="M2444.6,-196.382C2359.77,-193.481 2228.05,-185.408 2183.99,-163 2163.9,-152.78 2147.11,-133.415 2135.78,-117.487"/>

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 132 KiB

Before After
Before After

View file

@ -423,28 +423,6 @@
<ellipse fill="none" stroke="#2ea726" cx="675.993" cy="-75.322" rx="4.00002" ry="4.00002"/> <ellipse fill="none" stroke="#2ea726" cx="675.993" cy="-75.322" rx="4.00002" ry="4.00002"/>
<polygon fill="#2ea726" stroke="#2ea726" points="1666.82,-18.3546 1676.8,-22.9065 1671.82,-18.3806 1676.82,-18.4066 1676.82,-18.4066 1676.82,-18.4066 1671.82,-18.3806 1676.85,-13.9066 1666.82,-18.3546 1666.82,-18.3546"/> <polygon fill="#2ea726" stroke="#2ea726" points="1666.82,-18.3546 1676.8,-22.9065 1671.82,-18.3806 1676.82,-18.4066 1676.82,-18.4066 1676.82,-18.4066 1671.82,-18.3806 1676.85,-13.9066 1666.82,-18.3546 1666.82,-18.3546"/>
</g> </g>
<!-- AddressVersion -->
<g id="node20" class="node"><title>AddressVersion</title>
<path fill="none" stroke="black" d="M3306,-73.5C3306,-73.5 3412,-73.5 3412,-73.5 3418,-73.5 3424,-79.5 3424,-85.5 3424,-85.5 3424,-242.5 3424,-242.5 3424,-248.5 3418,-254.5 3412,-254.5 3412,-254.5 3306,-254.5 3306,-254.5 3300,-254.5 3294,-248.5 3294,-242.5 3294,-242.5 3294,-85.5 3294,-85.5 3294,-79.5 3300,-73.5 3306,-73.5"/>
<text text-anchor="middle" x="3359" y="-239.3" font-family="Times,serif" font-size="14.00">AddressVersion</text>
<polyline fill="none" stroke="black" points="3294,-231.5 3424,-231.5 "/>
<text text-anchor="start" x="3302" y="-216.3" font-family="Times,serif" font-size="14.00">id :integer</text>
<text text-anchor="start" x="3302" y="-201.3" font-family="Times,serif" font-size="14.00">item_type :string</text>
<text text-anchor="start" x="3302" y="-186.3" font-family="Times,serif" font-size="14.00">item_id :integer</text>
<text text-anchor="start" x="3302" y="-171.3" font-family="Times,serif" font-size="14.00">event :string</text>
<text text-anchor="start" x="3302" y="-156.3" font-family="Times,serif" font-size="14.00">whodunnit :string</text>
<text text-anchor="start" x="3302" y="-141.3" font-family="Times,serif" font-size="14.00">object :json</text>
<text text-anchor="start" x="3302" y="-126.3" font-family="Times,serif" font-size="14.00">object_changes :json</text>
<text text-anchor="start" x="3302" y="-111.3" font-family="Times,serif" font-size="14.00">created_at :datetime</text>
<text text-anchor="start" x="3302" y="-96.3" font-family="Times,serif" font-size="14.00">session :string</text>
<text text-anchor="start" x="3302" y="-81.3" font-family="Times,serif" font-size="14.00">children :json</text>
</g>
<!-- AddressVersion&#45;&gt;VersionAssociation -->
<g id="edge18" class="edge"><title>AddressVersion&#45;&gt;VersionAssociation</title>
<path fill="none" stroke="#798c06" d="M3287.01,-74.0397C3286.34,-73.6842 3285.67,-73.3375 3285,-73 3127.13,6.24968 3064.51,-60.9544 2888,-54 2500.09,-38.7165 2037.12,-26.1729 1846.12,-21.2463"/>
<ellipse fill="none" stroke="#798c06" cx="3290.53" cy="-76.1313" rx="4.00002" ry="4.00002"/>
<polygon fill="#798c06" stroke="#798c06" points="1845.86,-21.2395 1835.97,-16.4836 1840.86,-21.1108 1835.86,-20.9821 1835.86,-20.9821 1835.86,-20.9821 1840.86,-21.1108 1835.74,-25.4806 1845.86,-21.2395 1845.86,-21.2395"/>
</g>
<!-- BankStatementVersion --> <!-- BankStatementVersion -->
<g id="node21" class="node"><title>BankStatementVersion</title> <g id="node21" class="node"><title>BankStatementVersion</title>
<path fill="none" stroke="black" d="M606.5,-733.5C606.5,-733.5 725.5,-733.5 725.5,-733.5 731.5,-733.5 737.5,-739.5 737.5,-745.5 737.5,-745.5 737.5,-902.5 737.5,-902.5 737.5,-908.5 731.5,-914.5 725.5,-914.5 725.5,-914.5 606.5,-914.5 606.5,-914.5 600.5,-914.5 594.5,-908.5 594.5,-902.5 594.5,-902.5 594.5,-745.5 594.5,-745.5 594.5,-739.5 600.5,-733.5 606.5,-733.5"/> <path fill="none" stroke="black" d="M606.5,-733.5C606.5,-733.5 725.5,-733.5 725.5,-733.5 731.5,-733.5 737.5,-739.5 737.5,-745.5 737.5,-745.5 737.5,-902.5 737.5,-902.5 737.5,-908.5 731.5,-914.5 725.5,-914.5 725.5,-914.5 606.5,-914.5 606.5,-914.5 600.5,-914.5 594.5,-908.5 594.5,-902.5 594.5,-902.5 594.5,-745.5 594.5,-745.5 594.5,-739.5 600.5,-733.5 606.5,-733.5"/>
@ -2276,33 +2254,6 @@
<polygon fill="#3b5255" stroke="#3b5255" points="933.283,-1372.03 937.019,-1361.72 932.908,-1367.04 932.532,-1362.06 932.532,-1362.06 932.532,-1362.06 932.908,-1367.04 928.045,-1362.39 933.283,-1372.03 933.283,-1372.03"/> <polygon fill="#3b5255" stroke="#3b5255" points="933.283,-1372.03 937.019,-1361.72 932.908,-1367.04 932.532,-1362.06 932.532,-1362.06 932.532,-1362.06 932.908,-1367.04 928.045,-1362.39 933.283,-1372.03 933.283,-1372.03"/>
<text text-anchor="middle" x="1000" y="-1707.8" font-family="Times,serif" font-size="14.00">versions</text> <text text-anchor="middle" x="1000" y="-1707.8" font-family="Times,serif" font-size="14.00">versions</text>
</g> </g>
<!-- Address -->
<g id="node68" class="node"><title>Address</title>
<path fill="none" stroke="black" d="M3937,-473.5C3937,-473.5 4073,-473.5 4073,-473.5 4079,-473.5 4085,-479.5 4085,-485.5 4085,-485.5 4085,-702.5 4085,-702.5 4085,-708.5 4079,-714.5 4073,-714.5 4073,-714.5 3937,-714.5 3937,-714.5 3931,-714.5 3925,-708.5 3925,-702.5 3925,-702.5 3925,-485.5 3925,-485.5 3925,-479.5 3931,-473.5 3937,-473.5"/>
<text text-anchor="middle" x="4005" y="-699.3" font-family="Times,serif" font-size="14.00">Address</text>
<polyline fill="none" stroke="black" points="3925,-691.5 4085,-691.5 "/>
<text text-anchor="start" x="3933" y="-676.3" font-family="Times,serif" font-size="14.00">id :integer</text>
<text text-anchor="start" x="3933" y="-661.3" font-family="Times,serif" font-size="14.00">contact_id :integer</text>
<text text-anchor="start" x="3933" y="-646.3" font-family="Times,serif" font-size="14.00">city :string</text>
<text text-anchor="start" x="3933" y="-631.3" font-family="Times,serif" font-size="14.00">street :string</text>
<text text-anchor="start" x="3933" y="-616.3" font-family="Times,serif" font-size="14.00">zip :string</text>
<text text-anchor="start" x="3933" y="-601.3" font-family="Times,serif" font-size="14.00">created_at :datetime</text>
<text text-anchor="start" x="3933" y="-586.3" font-family="Times,serif" font-size="14.00">updated_at :datetime</text>
<text text-anchor="start" x="3933" y="-571.3" font-family="Times,serif" font-size="14.00">street2 :string</text>
<text text-anchor="start" x="3933" y="-556.3" font-family="Times,serif" font-size="14.00">street3 :string</text>
<text text-anchor="start" x="3933" y="-541.3" font-family="Times,serif" font-size="14.00">creator_str :string</text>
<text text-anchor="start" x="3933" y="-526.3" font-family="Times,serif" font-size="14.00">updator_str :string</text>
<text text-anchor="start" x="3933" y="-511.3" font-family="Times,serif" font-size="14.00">country_code :string</text>
<text text-anchor="start" x="3933" y="-496.3" font-family="Times,serif" font-size="14.00">state :string</text>
<text text-anchor="start" x="3933" y="-481.3" font-family="Times,serif" font-size="14.00">legacy_contact_id :integer</text>
</g>
<!-- Address&#45;&gt;AddressVersion -->
<g id="edge174" class="edge"><title>Address&#45;&gt;AddressVersion</title>
<path fill="none" stroke="#a84372" d="M3983.67,-465.242C3965.08,-396.369 3930.6,-316.747 3867,-273 3827.24,-245.647 3476.2,-276.515 3433,-255 3432.9,-254.952 3432.81,-254.904 3432.71,-254.856"/>
<ellipse fill="none" stroke="#a84372" cx="3984.73" cy="-469.286" rx="4.00001" ry="4.00001"/>
<polygon fill="#a84372" stroke="#a84372" points="3432.68,-254.84 3426.26,-245.953 3428.35,-252.347 3424.02,-249.854 3424.02,-249.854 3424.02,-249.854 3428.35,-252.347 3421.77,-253.754 3432.68,-254.84 3432.68,-254.84"/>
<text text-anchor="middle" x="4002" y="-360.3" font-family="Times,serif" font-size="14.00">versions</text>
</g>
<!-- LegalDocument&#45;&gt;LegalDocumentVersion --> <!-- LegalDocument&#45;&gt;LegalDocumentVersion -->
<g id="edge177" class="edge"><title>LegalDocument&#45;&gt;LegalDocumentVersion</title> <g id="edge177" class="edge"><title>LegalDocument&#45;&gt;LegalDocumentVersion</title>
<path fill="none" stroke="#109cef" d="M2781.55,-559.812C2709.48,-533.654 2604.67,-497.607 2511,-473 2470.28,-462.304 2447.06,-485.466 2418,-455 2370.61,-405.307 2361.52,-327.39 2363.51,-264.829"/> <path fill="none" stroke="#109cef" d="M2781.55,-559.812C2709.48,-533.654 2604.67,-497.607 2511,-473 2470.28,-462.304 2447.06,-485.466 2418,-455 2370.61,-405.307 2361.52,-327.39 2363.51,-264.829"/>

Before

Width:  |  Height:  |  Size: 244 KiB

After

Width:  |  Height:  |  Size: 239 KiB

Before After
Before After

View file

@ -1,6 +0,0 @@
Fabricator(:address) do
city 'test city'
street 'test street'
street2 'test street'
zip 12345
end

View file

@ -0,0 +1,18 @@
require 'rails_helper'
RSpec.describe DomainUpdateConfirmJob do
let(:domain) { instance_spy(Epp::Domain, registrant: registrant, errors: []) }
let(:registrant) { instance_double(Registrant) }
let(:registrant_change) { instance_spy(RegistrantChange) }
it 'confirms registrant change' do
expect(Epp::Domain).to receive(:find).and_return(domain)
expect(RegistrantChange).to receive(:new)
.with(domain: domain, old_registrant: registrant)
.and_return(registrant_change)
described_class.enqueue(domain_id = nil, action = RegistrantVerification::CONFIRMED)
expect(registrant_change).to have_received(:confirm)
end
end

View file

@ -1,59 +0,0 @@
require 'rails_helper'
RSpec.describe DomainMailer do
describe '#registrant_updated_notification_for_new_registrant', db: true do
subject(:message) { described_class.registrant_updated_notification_for_new_registrant(55, 55, 55, true) }
context 'when contact address processing is enabled' do
before :example do
allow(Contact).to receive(:address_processing?).and_return(true)
create(:domain, id: 55)
create(:registrant_with_address, id: 55)
end
it 'sends message' do
expect { message.deliver }.to change { ActionMailer::Base.deliveries.count }.by(1)
end
end
context 'when contact address processing is disabled' do
before :example do
allow(Contact).to receive(:address_processing?).and_return(false)
create(:domain, id: 55)
create(:registrant_without_address, id: 55)
end
it 'sends message' do
expect { message.deliver }.to change { ActionMailer::Base.deliveries.count }.by(1)
end
end
end
describe '#registrant_updated_notification_for_old_registrant', db: true do
subject(:message) { described_class.registrant_updated_notification_for_old_registrant(55, 55, 55, true) }
context 'when contact address processing is enabled' do
before :example do
allow(Contact).to receive(:address_processing?).and_return(true)
create(:domain, id: 55)
create(:registrant_with_address, id: 55)
end
it 'sends message' do
expect { message.deliver }.to change { ActionMailer::Base.deliveries.count }.by(1)
end
end
context 'when contact address processing is disabled' do
before :example do
allow(Contact).to receive(:address_processing?).and_return(false)
create(:domain, id: 55)
create(:registrant_without_address, id: 55)
end
it 'sends message' do
expect { message.deliver }.to change { ActionMailer::Base.deliveries.count }.by(1)
end
end
end
end

View file

@ -94,6 +94,40 @@ RSpec.describe RegistrantChangeMailer do
end end
end end
describe '#confirmed' do
let(:domain) { instance_spy(Domain, registrant_email: 'new.registrant@test.com') }
let(:old_registrant) { instance_spy(Registrant, email: 'old.registrant@test.com') }
let(:registrant_presenter) { instance_spy(RegistrantPresenter) }
let(:domain_presenter) { instance_spy(DomainPresenter) }
subject(:message) { described_class.confirmed(domain: domain, old_registrant: old_registrant) }
before :example do
allow(RegistrantPresenter).to receive(:new).and_return(registrant_presenter)
allow(DomainPresenter).to receive(:new).and_return(domain_presenter)
end
it 'has sender' do
expect(message.from).to eq(['noreply@internet.ee'])
end
it 'has new registrant email as a recipient' do
expect(message.to).to include('new.registrant@test.com')
end
it 'has old registrant email as a recipient' do
expect(message.to).to include('old.registrant@test.com')
end
it 'has subject' do
allow(domain).to receive(:name).and_return('test.com')
expect(message.subject).to eq(t('registrant_change_mailer.confirmed.subject', domain_name: 'test.com'))
end
it 'sends message' do
expect { message.deliver_now }.to change { ActionMailer::Base.deliveries.count }.by(1)
end
end
describe '#rejected' do describe '#rejected' do
let(:domain) { instance_spy(Domain, name: 'test.com', new_registrant_email: 'new.registrant@test.com') } let(:domain) { instance_spy(Domain, name: 'test.com', new_registrant_email: 'new.registrant@test.com') }
let(:registrar) { instance_spy(Registrar) } let(:registrar) { instance_spy(Registrar) }

View file

@ -1,71 +0,0 @@
require 'rails_helper'
describe Address do
context 'about class' do
it 'should have versioning enabled?' do
Address.paper_trail_enabled_for_model?.should == true
end
it 'should have custom log prexied table name for versions table' do
AddressVersion.table_name.should == 'log_addresses'
end
end
context 'with invalid attribute' do
before :all do
@address = Address.new
end
it 'should not be valid' do
@address.valid?
@address.errors.full_messages.should match_array([
])
end
it 'should not have any versions' do
@address.versions.should == []
end
end
context 'with valid attributes' do
before :all do
@address = Fabricate(:address)
end
it 'should be valid' do
@address.valid?
@address.errors.full_messages.should match_array([])
end
it 'should be valid twice' do
@address = Fabricate(:address)
@address.valid?
@address.errors.full_messages.should match_array([])
end
it 'should have one version' do
with_versioning do
@address.versions.should == []
@address.zip = 'New zip'
@address.save
@address.errors.full_messages.should match_array([])
@address.versions.size.should == 1
end
end
end
end
# TODO: country issue
# describe Address, '.extract_params' do
# it 'returns params hash' do
# Fabricate(:country, iso: 'EE')
# ph = { postalInfo: { name: 'fred', addr: { cc: 'EE', city: 'Village', street: 'street1' } } }
# expect(Address.extract_attributes(ph[:postalInfo])).to eq({
# address_attributes: {
# country_id: Country.find_by(iso: 'EE').id,
# city: 'Village',
# street: 'street1'
# }
# })
# end
# end

View file

@ -354,7 +354,7 @@ describe Contact, '.destroy_orphans' do
end end
end end
RSpec.describe Contact, db: false do RSpec.describe Contact do
it { is_expected.to alias_attribute(:kind, :ident_type) } it { is_expected.to alias_attribute(:kind, :ident_type) }
describe '::names' do describe '::names' do
@ -400,6 +400,16 @@ RSpec.describe Contact, db: false do
end end
end end
describe 'registrar validation', db: false do
let(:contact) { described_class.new }
it 'rejects absent' do
contact.registrar = nil
contact.validate
expect(contact.errors).to have_key(:registrar)
end
end
describe 'address validation', db: false do describe 'address validation', db: false do
let(:contact) { described_class.new } let(:contact) { described_class.new }
subject(:errors) { contact.errors } subject(:errors) { contact.errors }
@ -523,4 +533,66 @@ RSpec.describe Contact, db: false do
specify { expect(contact.id_code).to be_nil } specify { expect(contact.id_code).to be_nil }
end end
end end
describe '#ident_country' do
let(:contact) { described_class.new(ident_country_code: 'US') }
it 'returns ident country' do
expect(contact.ident_country).to eq(Country.new('US'))
end
end
describe '#used?' do
context 'when used as registrant' do
let(:registrant) { create(:registrant) }
before :example do
create(:domain, registrant: registrant)
registrant.reload
end
specify { expect(registrant).to be_used }
end
context 'when used as contact' do
let(:contact) { create(:contact) }
before :example do
domain = create(:domain)
domain.admin_domain_contacts << create(:admin_domain_contact, contact: contact)
contact.reload
end
specify { expect(contact).to be_used }
end
context 'when not used' do
let(:contact) { create(:contact) }
specify { expect(contact).to_not be_used }
end
end
describe '#domain_names_with_roles' do
let(:contact) { create(:registrant) }
subject(:domain_names) { contact.domain_names_with_roles }
it 'returns associated domains with roles' do
domain = create(:domain, registrant: contact, name: 'test.com')
domain.admin_domain_contacts << create(:admin_domain_contact, contact: contact)
domain.tech_domain_contacts << create(:tech_domain_contact, contact: contact)
contact.reload
expect(domain_names).to eq({ 'test.com' => %i[registrant admin_domain_contact tech_domain_contact].to_set })
end
it 'returns unique roles' do
domain = create(:domain, name: 'test.com')
2.times { domain.admin_domain_contacts << create(:admin_domain_contact, contact: contact) }
contact.reload
expect(domain_names).to eq({ 'test.com' => %i[admin_domain_contact].to_set })
end
end
end end

View file

@ -33,16 +33,6 @@ RSpec.describe Domain do
@domain = Domain.new @domain = Domain.new
end end
it 'should not be valid' do
@domain.valid?
@domain.errors.full_messages.should match_array([
"Admin domain contacts Admin contacts count must be between 1-10",
"Period Period is not a number",
"Registrant Registrant is missing",
"Registrar Registrar is missing"
])
end
it 'should not have any versions' do it 'should not have any versions' do
@domain.versions.should == [] @domain.versions.should == []
end end
@ -599,10 +589,84 @@ RSpec.describe Domain do
end end
end end
RSpec.describe Domain, db: false do RSpec.describe Domain do
it { is_expected.to alias_attribute(:on_hold_time, :outzone_at) } it { is_expected.to alias_attribute(:on_hold_time, :outzone_at) }
it { is_expected.to alias_attribute(:outzone_time, :outzone_at) } it { is_expected.to alias_attribute(:outzone_time, :outzone_at) }
describe 'registrar validation', db: false do
let(:domain) { described_class.new }
it 'rejects absent' do
domain.registrar = nil
domain.validate
expect(domain.errors).to have_key(:registrar)
end
end
describe 'registrant validation', db: false do
let(:domain) { described_class.new }
it 'rejects absent' do
domain.registrant = nil
domain.validate
expect(domain.errors).to have_key(:registrant)
end
end
describe 'period validation', db: false do
let(:domain) { described_class.new }
it 'rejects absent' do
domain.period = nil
domain.validate
expect(domain.errors).to have_key(:period)
end
it 'rejects fractional' do
domain.period = 1.1
domain.validate
expect(domain.errors).to have_key(:period)
end
it 'accepts integer' do
domain.period = 1
domain.validate
expect(domain.errors).to_not have_key(:period)
end
end
describe 'admin contact count validation' do
let(:domain) { described_class.new }
before :example do
Setting.admin_contacts_min_count = 1
Setting.admin_contacts_max_count = 2
end
it 'rejects less than min' do
domain.validate
expect(domain.errors).to have_key(:admin_domain_contacts)
end
it 'rejects more than max' do
(Setting.admin_contacts_max_count + 1).times { domain.admin_domain_contacts << build(:admin_domain_contact) }
domain.validate
expect(domain.errors).to have_key(:admin_domain_contacts)
end
it 'accepts min' do
Setting.admin_contacts_min_count.times { domain.admin_domain_contacts << build(:admin_domain_contact) }
domain.validate
expect(domain.errors).to_not have_key(:admin_domain_contacts)
end
it 'accepts max' do
Setting.admin_contacts_max_count.times { domain.admin_domain_contacts << build(:admin_domain_contact) }
domain.validate
expect(domain.errors).to_not have_key(:admin_domain_contacts)
end
end
describe 'nameserver validation', db: true do describe 'nameserver validation', db: true do
let(:domain) { described_class.new } let(:domain) { described_class.new }

View file

@ -4,29 +4,78 @@ RSpec.describe RegistrantPresenter do
let(:registrant) { instance_double(Registrant) } let(:registrant) { instance_double(Registrant) }
let(:presenter) { described_class.new(registrant: registrant, view: view) } let(:presenter) { described_class.new(registrant: registrant, view: view) }
registrant_delegate_attributes = %i( describe '#country' do
let(:country) { instance_double(Country) }
before :example do
allow(registrant).to receive(:country).and_return(country)
end
it 'returns country name in current locale by default' do
expect(country).to receive(:translation).with(I18n.locale).and_return('test country')
expect(presenter.country).to eq('test country')
end
it 'returns country name in given locale' do
expect(country).to receive(:translation).with(:de).and_return('test country')
expect(presenter.country(locale: :de)).to eq('test country')
end
end
describe '#ident_country' do
let(:ident_country) { instance_double(Country) }
before :example do
allow(registrant).to receive(:ident_country).and_return(ident_country)
end
it 'returns country name in current locale by default' do
expect(ident_country).to receive(:translation).with(I18n.locale).and_return('test country')
expect(presenter.ident_country).to eq('test country')
end
it 'returns country name in given locale' do
expect(ident_country).to receive(:translation).with(:de).and_return('test country')
expect(presenter.ident_country(locale: :de)).to eq('test country')
end
end
describe '#domain_names_with_roles' do
before :example do
roles = %i[registrant admin_domain_contact tech_domain_contact]
allow(registrant).to receive(:domain_names_with_roles)
.and_return({ 'test.com' => roles,
'test.org' => %i[registrant] })
end
it 'returns domain names with unique roles in current locale by default' do
text = "test.com (Registrant, Administrative contact, Technical contact)" \
"\ntest.org (Registrant)"
expect(presenter.domain_names_with_roles).to eq(text)
end
end
registrant_delegatable_attributes = %i(
name name
ident ident
phone
email email
priv? priv?
street street
city city
state
zip
id_code id_code
reg_no reg_no
used?
) )
registrant_delegate_attributes.each do |attribute_name| registrant_delegatable_attributes.each do |attr_name|
describe "##{attribute_name}" do describe "##{attr_name}" do
it 'delegetes to registrant' do it 'delegates to registrant' do
expect(registrant).to receive(attribute_name).and_return('test') expect(registrant).to receive(attr_name).and_return('test')
expect(presenter.send(attribute_name)).to eq('test') expect(presenter.send(attr_name)).to eq('test')
end end
end end
end end
describe '#country' do
it 'returns country name' do
expect(presenter.country).to be_nil
end
end
end end

View file

@ -9,7 +9,6 @@ require 'support/requests/session_helpers'
require 'support/requests/epp_helpers' require 'support/requests/epp_helpers'
require 'support/features/session_helpers' require 'support/features/session_helpers'
require 'support/matchers/alias_attribute' require 'support/matchers/alias_attribute'
require 'support/matchers/active_job'
require 'support/matchers/epp/code' require 'support/matchers/epp/code'
require 'support/capybara' require 'support/capybara'
@ -28,6 +27,7 @@ RSpec.configure do |config|
config.include Features::SessionHelpers, type: :feature config.include Features::SessionHelpers, type: :feature
config.include AbstractController::Translation, type: :request config.include AbstractController::Translation, type: :request
config.include AbstractController::Translation, type: :feature config.include AbstractController::Translation, type: :feature
config.include AbstractController::Translation, type: :mailer
config.include Requests::EPPHelpers, type: :request config.include Requests::EPPHelpers, type: :request
config.define_derived_metadata(file_path: %r[/spec/features/]) do |metadata| config.define_derived_metadata(file_path: %r[/spec/features/]) do |metadata|

View file

@ -0,0 +1,20 @@
require 'rails_helper'
RSpec.describe RegistrantChange do
describe '#confirm' do
let(:domain) { instance_double(Domain) }
let(:old_registrant) { instance_double(Registrant) }
let(:message) { instance_spy(ActionMailer::MessageDelivery) }
before :example do
allow(RegistrantChangeMailer).to receive(:confirmed)
.with(domain: domain, old_registrant: old_registrant)
.and_return(message)
described_class.new(domain: domain, old_registrant: old_registrant).confirm
end
it 'notifies registrant' do
expect(message).to have_received(:deliver_now)
end
end
end

View file

@ -6,17 +6,7 @@ if ENV['TRAVIS']
SimpleCov.start SimpleCov.start
end end
RSpec.configure do |config| RSpec.configure do |config|
# https://github.com/rspec/rspec-rails/issues/1076
config.around :each, type: :view do |example|
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = false
example.run
mocks.verify_partial_doubles = true
end
end
# rspec-expectations config goes here. You can use an alternate # rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest # assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer. # assertions if you prefer.

View file

@ -1,252 +0,0 @@
require "active_job/base"
require "active_job/arguments"
# This matcher is needed because it is absent it rspec-rails 3.3.2
module RSpec
module Rails
module Matchers
# Namespace for various implementations of ActiveJob features
#
# @api private
module ActiveJob
# rubocop: disable Style/ClassLength
# @private
class Base < RSpec::Matchers::BuiltIn::BaseMatcher
def initialize
@args = []
@queue = nil
@at = nil
@block = Proc.new {}
set_expected_number(:exactly, 1)
end
def with(*args, &block)
@args = args
@block = block if block.present?
self
end
def on_queue(queue)
@queue = queue
self
end
def at(date)
@at = date
self
end
def exactly(count)
set_expected_number(:exactly, count)
self
end
def at_least(count)
set_expected_number(:at_least, count)
self
end
def at_most(count)
set_expected_number(:at_most, count)
self
end
def times
self
end
def once
exactly(:once)
end
def twice
exactly(:twice)
end
def thrice
exactly(:thrice)
end
def failure_message
"expected to enqueue #{base_message}"
end
def failure_message_when_negated
"expected not to enqueue #{base_message}"
end
def message_expectation_modifier
case @expectation_type
when :exactly then "exactly"
when :at_most then "at most"
when :at_least then "at least"
end
end
def supports_block_expectations?
true
end
private
def check(jobs)
@matching_jobs_count = jobs.count do |job|
if serialized_attributes.all? { |key, value| value == job[key] }
args = ::ActiveJob::Arguments.deserialize(job[:args])
@block.call(*args)
true
else
false
end
end
case @expectation_type
when :exactly then @expected_number == @matching_jobs_count
when :at_most then @expected_number >= @matching_jobs_count
when :at_least then @expected_number <= @matching_jobs_count
end
end
def base_message
"#{message_expectation_modifier} #{@expected_number} jobs,".tap do |msg|
msg << " with #{@args}," if @args.any?
msg << " on queue #{@queue}," if @queue
msg << " at #{@at}," if @at
msg << " but enqueued #{@matching_jobs_count}"
end
end
def serialized_attributes
{}.tap do |attributes|
attributes[:args] = ::ActiveJob::Arguments.serialize(@args) if @args.any?
attributes[:at] = @at.to_f if @at
attributes[:queue] = @queue if @queue
attributes[:job] = @job if @job
end
end
def set_expected_number(relativity, count)
@expectation_type = relativity
@expected_number = case count
when :once then 1
when :twice then 2
when :thrice then 3
else Integer(count)
end
end
def queue_adapter
::ActiveJob::Base.queue_adapter
end
end
# rubocop: enable Style/ClassLength
# @private
class HaveEnqueuedJob < Base
def initialize(job)
super()
@job = job
end
def matches?(proc)
raise ArgumentError, "have_enqueued_job and enqueue_job only support block expectations" unless Proc === proc
original_enqueued_jobs_count = queue_adapter.enqueued_jobs.count
proc.call
in_block_jobs = queue_adapter.enqueued_jobs.drop(original_enqueued_jobs_count)
check(in_block_jobs)
end
end
# @private
class HaveBeenEnqueued < Base
def matches?(job)
@job = job
check(queue_adapter.enqueued_jobs)
end
end
end
# @api public
# Passes if a job has been enqueued inside block. May chain at_least, at_most or exactly to specify a number of times.
#
# @example
# expect {
# HeavyLiftingJob.perform_later
# }.to have_enqueued_job
#
# # Using alias
# expect {
# HeavyLiftingJob.perform_later
# }.to enqueue_job
#
# expect {
# HelloJob.perform_later
# HeavyLiftingJob.perform_later
# }.to have_enqueued_job(HelloJob).exactly(:once)
#
# expect {
# 3.times { HelloJob.perform_later }
# }.to have_enqueued_job(HelloJob).at_least(2).times
#
# expect {
# HelloJob.perform_later
# }.to have_enqueued_job(HelloJob).at_most(:twice)
#
# expect {
# HelloJob.perform_later
# HeavyLiftingJob.perform_later
# }.to have_enqueued_job(HelloJob).and have_enqueued_job(HeavyLiftingJob)
#
# expect {
# HelloJob.set(wait_until: Date.tomorrow.noon, queue: "low").perform_later(42)
# }.to have_enqueued_job.with(42).on_queue("low").at(Date.tomorrow.noon)
def have_enqueued_job(job = nil)
check_active_job_adapter
ActiveJob::HaveEnqueuedJob.new(job)
end
alias_method :enqueue_job, :have_enqueued_job
# @api public
# Passes if a job has been enqueued. May chain at_least, at_most or exactly to specify a number of times.
#
# @example
# before { ActiveJob::Base.queue_adapter.enqueued_jobs.clear }
#
# HeavyLiftingJob.perform_later
# expect(HeavyLiftingJob).to have_been_enqueued
#
# HelloJob.perform_later
# HeavyLiftingJob.perform_later
# expect(HeavyLiftingJob).to have_been_enqueued.exactly(:once)
#
# 3.times { HelloJob.perform_later }
# expect(HelloJob).to have_been_enqueued.at_least(2).times
#
# HelloJob.perform_later
# expect(HelloJob).to enqueue_job(HelloJob).at_most(:twice)
#
# HelloJob.perform_later
# HeavyLiftingJob.perform_later
# expect(HelloJob).to have_been_enqueued
# expect(HeavyLiftingJob).to have_been_enqueued
#
# HelloJob.set(wait_until: Date.tomorrow.noon, queue: "low").perform_later(42)
# expect(HelloJob).to have_been_enqueued.with(42).on_queue("low").at(Date.tomorrow.noon)
def have_been_enqueued
check_active_job_adapter
ActiveJob::HaveBeenEnqueued.new
end
private
# @private
def check_active_job_adapter
return if ::ActiveJob::QueueAdapters::TestAdapter === ::ActiveJob::Base.queue_adapter
raise StandardError, "To use ActiveJob matchers set `ActiveJob::Base.queue_adapter = :test`"
end
end
end
end

View file

@ -5,10 +5,13 @@ RSpec.describe 'admin/billing/prices/_form' do
let(:price) { build_stubbed(:price) } let(:price) { build_stubbed(:price) }
before :example do before :example do
without_partial_double_verification do
allow(view).to receive(:price).and_return(price) allow(view).to receive(:price).and_return(price)
allow(view).to receive(:zones).and_return([]) allow(view).to receive(:zones).and_return([])
allow(view).to receive(:operation_categories).and_return([]) allow(view).to receive(:operation_categories).and_return([])
allow(view).to receive(:durations).and_return([]) allow(view).to receive(:durations).and_return([])
end
stub_template '_form_errors' => '' stub_template '_form_errors' => ''
end end

View file

@ -6,7 +6,10 @@ RSpec.describe 'admin/domains/edit' do
before :example do before :example do
allow(DomainPresenter).to receive(:new).and_return(domain_presenter) allow(DomainPresenter).to receive(:new).and_return(domain_presenter)
without_partial_double_verification do
allow(view).to receive(:force_delete_templates) allow(view).to receive(:force_delete_templates)
end
assign(:domain, domain) assign(:domain, domain)

View file

@ -0,0 +1,32 @@
require 'rails_helper'
RSpec.describe 'mailers/contact_mailer/email_updated.html.erb' do
let(:contact) { instance_spy(Contact) }
let(:contact_presenter) { instance_spy(RegistrantPresenter) }
let(:registrar_presenter) { instance_spy(RegistrarPresenter) }
before :example do
allow(RegistrantPresenter).to receive(:new).and_return(contact_presenter)
allow(RegistrarPresenter).to receive(:new).and_return(registrar_presenter)
assign(:contact, contact)
assign(:old_email, 'test@test.com')
stub_template 'mailers/shared/registrant/_registrant.et.html' => ''
stub_template 'mailers/shared/registrant/_registrant.en.html' => ''
stub_template 'mailers/shared/registrar/_registrar.et.html' => ''
stub_template 'mailers/shared/registrar/_registrar.en.html' => ''
end
it 'has affected domain list in estonian' do
expect(contact_presenter).to receive(:domain_names_with_roles).with(locale: :et, line_break: '<br>').and_return('test domain list et')
render
expect(rendered).to have_text('test domain list et')
end
it 'has affected domain list in english' do
expect(contact_presenter).to receive(:domain_names_with_roles).with(line_break: '<br>').and_return('test domain list en')
render
expect(rendered).to have_text('test domain list en')
end
end

View file

@ -0,0 +1,32 @@
require 'rails_helper'
RSpec.describe 'mailers/contact_mailer/email_updated.text.erb' do
let(:contact) { instance_spy(Contact) }
let(:contact_presenter) { instance_spy(RegistrantPresenter) }
let(:registrar_presenter) { instance_spy(RegistrarPresenter) }
before :example do
allow(RegistrantPresenter).to receive(:new).and_return(contact_presenter)
allow(RegistrarPresenter).to receive(:new).and_return(registrar_presenter)
assign(:contact, contact)
assign(:old_email, 'test@test.com')
stub_template 'mailers/shared/registrant/_registrant.et.text' => ''
stub_template 'mailers/shared/registrant/_registrant.en.text' => ''
stub_template 'mailers/shared/registrar/_registrar.et.text' => ''
stub_template 'mailers/shared/registrar/_registrar.en.text' => ''
end
it 'has affected domain list in estonian' do
expect(contact_presenter).to receive(:domain_names_with_roles).with(locale: :et).and_return('test domain list et')
render
expect(rendered).to have_text('test domain list et')
end
it 'has affected domain list in english' do
expect(contact_presenter).to receive(:domain_names_with_roles).and_return('test domain list en')
render
expect(rendered).to have_text('test domain list en')
end
end

View file

@ -2,5 +2,5 @@ require 'rails_helper'
require_relative 'registrant_shared' require_relative 'registrant_shared'
RSpec.describe 'mailers/shared/registrant/_registrant.en.html.erb' do RSpec.describe 'mailers/shared/registrant/_registrant.en.html.erb' do
include_examples 'domain mailer registrant info' include_examples 'domain mailer registrant info', 'mailers/shared/registrant/_registrant.en.html.erb'
end end

View file

@ -2,5 +2,5 @@ require 'rails_helper'
require_relative 'registrant_shared' require_relative 'registrant_shared'
RSpec.describe 'mailers/shared/registrant/_registrant.en.text.erb' do RSpec.describe 'mailers/shared/registrant/_registrant.en.text.erb' do
include_examples 'domain mailer registrant info' include_examples 'domain mailer registrant info', 'mailers/shared/registrant/_registrant.en.text.erb'
end end

View file

@ -2,5 +2,5 @@ require 'rails_helper'
require_relative 'registrant_shared' require_relative 'registrant_shared'
RSpec.describe 'mailers/shared/registrant/_registrant.et.html.erb' do RSpec.describe 'mailers/shared/registrant/_registrant.et.html.erb' do
include_examples 'domain mailer registrant info' include_examples 'domain mailer registrant info', 'mailers/shared/registrant/_registrant.et.html.erb'
end end

View file

@ -2,5 +2,5 @@ require 'rails_helper'
require_relative 'registrant_shared' require_relative 'registrant_shared'
RSpec.describe 'mailers/shared/registrant/_registrant.et.text.erb' do RSpec.describe 'mailers/shared/registrant/_registrant.et.text.erb' do
include_examples 'domain mailer registrant info' include_examples 'domain mailer registrant info', 'mailers/shared/registrant/_registrant.et.text.erb'
end end

View file

@ -1,25 +1,87 @@
require 'rails_helper' require 'rails_helper'
RSpec.shared_examples 'domain mailer registrant info' do RSpec.shared_examples 'domain mailer registrant info' do |template_path|
let(:template_path) { template_path }
let(:registrant) { instance_spy(RegistrantPresenter) } let(:registrant) { instance_spy(RegistrantPresenter) }
before :example do before :example do
without_partial_double_verification do
allow(view).to receive(:registrant).and_return(registrant) allow(view).to receive(:registrant).and_return(registrant)
allow(view).to receive(:address_processing)
end
end end
attributes = %i( it 'has name' do
name allow(registrant).to receive(:name).and_return('test name')
ident render template: template_path
street expect(rendered).to have_text('test name')
city end
country
)
attributes.each do |attr_name| it 'has ident' do
allow(registrant).to receive(:ident).and_return('test ident')
render template: template_path
expect(rendered).to have_text('test ident')
end
context 'when :with_phone is true' do
it 'has phone' do
allow(registrant).to receive(:phone).and_return('test phone')
render template: template_path, locals: { with_phone: true }
expect(rendered).to have_text('test phone')
end
end
context 'when :with_phone is false' do
it 'has no phone' do
allow(registrant).to receive(:phone).and_return('test phone')
render template: template_path, locals: { with_phone: false }
expect(rendered).to_not have_text('test phone')
end
end
address_attributes = %i[street city state zip country]
context 'when address processing is enabled' do
before :example do
without_partial_double_verification do
allow(view).to receive(:address_processing).and_return(true)
end
end
address_attributes.each do |attr_name|
it "has #{attr_name}" do it "has #{attr_name}" do
expect(registrant).to receive(attr_name).and_return("test #{attr_name}") allow(registrant).to receive(attr_name).and_return("test #{attr_name}")
render render template: template_path
expect(rendered).to have_text("test #{attr_name}") expect(rendered).to have_text("test #{attr_name}")
end end
end end
it 'has no ident country' do
allow(registrant).to receive(:ident_country).and_return('test ident country')
render template: template_path
expect(rendered).to_not have_text('test ident country')
end
end
context 'when address processing is disabled' do
before :example do
without_partial_double_verification do
allow(view).to receive(:address_processing).and_return(false)
end
end
address_attributes.each do |attr_name|
it "has no #{attr_name}" do
allow(registrant).to receive(attr_name).and_return("test #{attr_name}")
render template: template_path
expect(rendered).to_not have_text("test #{attr_name}")
end
end
it 'has ident country' do
allow(registrant).to receive(:ident_country).and_return('test ident country')
render template: template_path
expect(rendered).to have_text('test ident country')
end
end
end end

View file

@ -4,8 +4,10 @@ RSpec.shared_examples 'domain mailer registrar info' do
let(:registrar) { instance_spy(RegistrarPresenter) } let(:registrar) { instance_spy(RegistrarPresenter) }
before :example do before :example do
without_partial_double_verification do
allow(view).to receive(:registrar).and_return(registrar) allow(view).to receive(:registrar).and_return(registrar)
end end
end
attributes = %i( attributes = %i(
name name

View file

@ -4,7 +4,10 @@ RSpec.describe 'registrar/contacts/_form' do
let(:contact) { instance_spy(Depp::Contact) } let(:contact) { instance_spy(Depp::Contact) }
before :example do before :example do
without_partial_double_verification do
allow(view).to receive(:f).and_return(ActionView::Helpers::FormBuilder.new(:contact, contact, view, {})) allow(view).to receive(:f).and_return(ActionView::Helpers::FormBuilder.new(:contact, contact, view, {}))
end
assign(:contact, contact) assign(:contact, contact)
stub_template 'registrar/shared/_error_messages' => '' stub_template 'registrar/shared/_error_messages' => ''
@ -16,8 +19,10 @@ RSpec.describe 'registrar/contacts/_form' do
context 'when address processing is enabled' do context 'when address processing is enabled' do
before do before do
without_partial_double_verification do
allow(view).to receive(:address_processing?).and_return(true) allow(view).to receive(:address_processing?).and_return(true)
end end
end
it 'has address' do it 'has address' do
render render
@ -27,8 +32,10 @@ RSpec.describe 'registrar/contacts/_form' do
context 'when address processing is disabled' do context 'when address processing is disabled' do
before do before do
without_partial_double_verification do
allow(view).to receive(:address_processing?).and_return(false) allow(view).to receive(:address_processing?).and_return(false)
end end
end
it 'has no address' do it 'has no address' do
render render

View file

@ -4,7 +4,10 @@ RSpec.describe 'registrar/contacts/form/_legal_document' do
let(:contact) { instance_spy(Depp::Contact) } let(:contact) { instance_spy(Depp::Contact) }
before :example do before :example do
without_partial_double_verification do
allow(view).to receive(:f).and_return(DefaultFormBuilder.new(:depp_contact, contact, view, {})) allow(view).to receive(:f).and_return(DefaultFormBuilder.new(:depp_contact, contact, view, {}))
end
assign(:contact, contact) assign(:contact, contact)
end end

View file

@ -4,7 +4,10 @@ RSpec.describe 'registrar/domains/_form' do
let(:domain) { instance_spy(Depp::Domain) } let(:domain) { instance_spy(Depp::Domain) }
before :example do before :example do
without_partial_double_verification do
allow(view).to receive(:f).and_return(DefaultFormBuilder.new(:domain, domain, view, {})) allow(view).to receive(:f).and_return(DefaultFormBuilder.new(:domain, domain, view, {}))
end
assign(:domain, domain) assign(:domain, domain)
stub_template 'registrar/domains/form/_general' => '' stub_template 'registrar/domains/form/_general' => ''