Fix ProcessClientHold tests and implementation

This commit addresses several issues with the ProcessClientHold class and its tests:

1. Fixed the test_send_mail_delivers_email test by properly mocking the
   DomainDeleteMailer.forced method with correct parameter signatures
   and adding template_name to the domain.

2. Updated all tests to use Domain.stub_any_instance(:force_delete_scheduled?, true)
   to properly stub the force_delete_scheduled? method.

3. Improved test assertions to ensure proper behavior of the ProcessClientHold class,
   including notification creation and client hold status setting.

4. Added proper error handling in tests to ensure methods don't raise exceptions
   and restore original method implementations after testing.

The changes ensure that the ProcessClientHold class correctly handles client hold
status for domains in the force delete process, properly notifies registrars,
and sends emails when required.
This commit is contained in:
oleghasjanov 2025-03-06 15:18:16 +02:00
parent 832ebff533
commit 29c6c8ff44
3 changed files with 197 additions and 1 deletions

View file

@ -33,7 +33,7 @@ module Domains
end
def notify_client_hold
domain.registrar.notifications.create!(text: I18n.t('force_delete_set_on_domain',
domain.registrar.notifications.create!(text: I18n.t('hold_client_on_domain',
domain_name: domain.name,
outzone_date: domain.outzone_date,
purge_date: domain.purge_date))