fixed error

This commit is contained in:
olegphenomenon 2021-11-15 13:39:05 +02:00
parent 8524503582
commit 2543b9c1f8
6 changed files with 20 additions and 155 deletions

View file

@ -100,65 +100,6 @@ class VerifyEmailTaskTest < ActiveJob::TestCase
assert_equal ValidationEvent.all.count, 9
end
def test_should_set_fd_for_domains_which_related_to_failed_emails
assert_equal ValidationEvent.count, 0
run_task
assert_equal Contact.count, 9
assert_equal ValidationEvent.count, 8 # Contact has duplicate email and it is skip
contact = contacts(:john)
v = ValidationEvent.find_by(validation_eventable_id: contact.id)
v.update!(success: false)
4.times do
contact.validation_events << v.dup
end
run_task
assert_equal ValidationEvent.all.count, 13
assert contact.domains.last.force_delete_scheduled?
end
def test_change_failed_email_to_another_faield_email_shouldnt_to_remove_fd
assert_equal ValidationEvent.count, 0
run_task
assert_equal Contact.count, 9
assert_equal ValidationEvent.count, 8 # Contact has duplicate email and it is skip
contact = contacts(:john)
v = ValidationEvent.find_by(validation_eventable_id: contact.id)
v.update!(success: false)
4.times do
contact.validation_events << v.dup
end
run_task
assert_equal ValidationEvent.all.count, 13
assert contact.domains.last.force_delete_scheduled?
contact.email = "another@inbox.txt"
contact.save
contact.reload
v = ValidationEvent.find_by(validation_eventable_id: contact.id)
v.update!(success: false)
run_task
assert contact.domains.last.force_delete_scheduled?
end
def test_tasks_verifies_emails
capture_io { run_task }
assert ValidationEvent.validated_ids_by(Contact).include? @contact.id
assert @contact.validation_events.last.success
refute @invalid_contact.validation_events.last.success
refute ValidationEvent.validated_ids_by(Contact).include? @invalid_contact.id
end
def run_task
perform_enqueued_jobs do
Rake::Task['verify_email:check_all'].execute