Skip to content

Commit

Permalink
Merge pull request #1197 from internetee/fix-domain-delete-procedure
Browse files Browse the repository at this point in the history
Notify registrar about domain deletion when auction feature is on
  • Loading branch information
vohmar authored May 10, 2019
2 parents 8188def + 5d5c2ed commit c018ec8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/models/concerns/domain/releasable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ def release
transaction do
domain_name.sell_at_auction if domain_name.auctionable?
destroy!
registrar.notifications.create!(text: "#{I18n.t(:domain_deleted)}: #{name}",
attached_obj_id: id,
attached_obj_type: self.class)
end
else
discard
Expand Down
9 changes: 9 additions & 0 deletions test/models/domain/releasable/auctionable_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ def test_deletes_registered_domain
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
@domain.update!(delete_date: '2010-07-06')
travel_to Time.zone.parse('2010-07-05')
Expand Down

0 comments on commit c018ec8

Please sign in to comment.