Fix deprecated email_notification usage in tests

This commit is contained in:
Alex Sherman 2021-07-06 14:45:11 +05:00
parent d48b0f4401
commit 70a6a44525
12 changed files with 15 additions and 164 deletions

View file

@ -6,7 +6,7 @@
# For email_validation event kind also check_level (regex/mx/smtp) is stored in the event_data
class ValidationEvent < ApplicationRecord
enum event_type: ValidationEvent::EventType::TYPES, _suffix: true
VALIDATION_PERIOD = 1.month.ago.freeze
VALIDATION_PERIOD = 1.month.freeze
VALID_CHECK_LEVELS = %w[regex mx smtp].freeze
VALID_EVENTS_COUNT_THRESHOLD = 5
@ -26,7 +26,7 @@ class ValidationEvent < ApplicationRecord
belongs_to :validation_eventable, polymorphic: true
scope :recent, -> { where('created_at > ?', VALIDATION_PERIOD) }
scope :recent, -> { where('created_at > ?', Time.zone.now - VALIDATION_PERIOD) }
scope :successful, -> { where(success: true) }
scope :failed, -> { where(success: false) }
scope :regex, -> { where('event_data @> ?', { 'check_level': 'regex' }.to_json) }