mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 10:45:58 +02:00
Add tests for DOmainCrone#expire_period
This commit is contained in:
parent
d17e26c28b
commit
167b37c61f
1 changed files with 28 additions and 0 deletions
28
test/interactions/expire_period/start_test.rb
Normal file
28
test/interactions/expire_period/start_test.rb
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class StartTest < ActiveSupport::TestCase
|
||||||
|
include ActionMailer::TestHelper
|
||||||
|
|
||||||
|
setup do
|
||||||
|
@domain = domains(:shop)
|
||||||
|
@domain.update(expire_time: Time.zone.now - 1.day)
|
||||||
|
ActionMailer::Base.deliveries.clear
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_sets_expired
|
||||||
|
job_count = lambda do
|
||||||
|
QueJob.where("args->>0 = '#{@domain.id}'", job_class: DomainExpireEmailJob.name).count
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_difference job_count, 1 do
|
||||||
|
perform_enqueued_jobs do
|
||||||
|
DomainCron.start_expire_period
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@domain.reload
|
||||||
|
assert @domain.statuses.include?(DomainStatus::EXPIRED)
|
||||||
|
assert_equal @domain.outzone_at, @domain.expire_time + Domain.expire_warning_period
|
||||||
|
assert_equal @domain.delete_date, (@domain.outzone_at + Domain.redemption_grace_period).to_date
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue