Merge pull request #1197 from internetee/fix-domain-delete-procedure

Notify registrar about domain deletion when auction feature is on
This commit is contained in:
Timo Võhmar 2019-05-10 15:10:35 +03:00 committed by GitHub
commit c018ec84a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -42,6 +42,9 @@ module Concerns
transaction do transaction do
domain_name.sell_at_auction if domain_name.auctionable? domain_name.sell_at_auction if domain_name.auctionable?
destroy! destroy!
registrar.notifications.create!(text: "#{I18n.t(:domain_deleted)}: #{name}",
attached_obj_id: id,
attached_obj_type: self.class)
end end
else else
discard discard

View file

@ -58,6 +58,15 @@ class DomainReleasableAuctionableTest < ActiveSupport::TestCase
end end
end end
def test_notifies_registrar
@domain.update!(delete_date: '2010-07-04')
travel_to Time.zone.parse('2010-07-05')
assert_difference -> { @domain.registrar.notifications.count } do
Domain.release_domains
end
end
def test_ignores_domains_with_delete_date_in_the_future def test_ignores_domains_with_delete_date_in_the_future
@domain.update!(delete_date: '2010-07-06') @domain.update!(delete_date: '2010-07-06')
travel_to Time.zone.parse('2010-07-05') travel_to Time.zone.parse('2010-07-05')