mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 21:25:39 +02:00
added tests
This commit is contained in:
parent
9f1cf8f620
commit
c22232ce07
4 changed files with 24 additions and 4 deletions
|
@ -4,7 +4,6 @@ module Domain::Releasable
|
||||||
class_methods do
|
class_methods do
|
||||||
def release_domains
|
def release_domains
|
||||||
releasable_domains.each do |domain|
|
releasable_domains.each do |domain|
|
||||||
|
|
||||||
domain.release
|
domain.release
|
||||||
yield domain if block_given?
|
yield domain if block_given?
|
||||||
end
|
end
|
||||||
|
|
|
@ -160,7 +160,7 @@ class DomainStatus < ApplicationRecord
|
||||||
['TechChangeProhibited', SERVER_TECH_CHANGE_PROHIBITED],
|
['TechChangeProhibited', SERVER_TECH_CHANGE_PROHIBITED],
|
||||||
['UpdateProhibited', SERVER_UPDATE_PROHIBITED],
|
['UpdateProhibited', SERVER_UPDATE_PROHIBITED],
|
||||||
['DeleteProhibited', SERVER_DELETE_PROHIBITED],
|
['DeleteProhibited', SERVER_DELETE_PROHIBITED],
|
||||||
['ServerReleaseProhibited', SERVER_RELEASE_PROHIBITED],
|
['ReleaseProhibited', SERVER_RELEASE_PROHIBITED],
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -99,10 +99,21 @@ class DomainReleasableAuctionableTest < ActiveJob::TestCase
|
||||||
assert_not @domain.domain_name.at_auction?
|
assert_not @domain.domain_name.at_auction?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_ignores_domains_with_server_delete_prohibited_status
|
def test_does_not_ignore_domains_with_server_delete_prohibited_status
|
||||||
@domain.update!(delete_date: '2010-07-04', statuses: [DomainStatus::SERVER_DELETE_PROHIBITED])
|
@domain.update!(delete_date: '2010-07-04', statuses: [DomainStatus::SERVER_DELETE_PROHIBITED])
|
||||||
travel_to Time.zone.parse('2010-07-05')
|
travel_to Time.zone.parse('2010-07-05')
|
||||||
|
|
||||||
|
assert_changes 'Domain.count' do
|
||||||
|
Domain.release_domains
|
||||||
|
end
|
||||||
|
|
||||||
|
assert @domain.domain_name.at_auction?
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_ignores_domains_with_server_release_prohibited_status
|
||||||
|
@domain.update!(delete_date: '2010-07-04', statuses: [DomainStatus::SERVER_RELEASE_PROHIBITED])
|
||||||
|
travel_to Time.zone.parse('2010-07-05')
|
||||||
|
|
||||||
assert_no_difference 'Domain.count' do
|
assert_no_difference 'Domain.count' do
|
||||||
Domain.release_domains
|
Domain.release_domains
|
||||||
end
|
end
|
||||||
|
|
|
@ -51,13 +51,23 @@ class DomainReleasableDiscardableTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_ignores_domains_with_server_delete_prohibited_status
|
def test_does_not_ignore_domains_with_server_delete_prohibited_status
|
||||||
@domain.update!(delete_date: '2010-07-04', statuses: [DomainStatus::SERVER_DELETE_PROHIBITED])
|
@domain.update!(delete_date: '2010-07-04', statuses: [DomainStatus::SERVER_DELETE_PROHIBITED])
|
||||||
travel_to Time.zone.parse('2010-07-05')
|
travel_to Time.zone.parse('2010-07-05')
|
||||||
|
|
||||||
Domain.release_domains
|
Domain.release_domains
|
||||||
@domain.reload
|
@domain.reload
|
||||||
|
|
||||||
|
assert @domain.discarded?
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_ignores_domains_with_server_release_prohibited_status
|
||||||
|
@domain.update!(delete_date: '2010-07-04', statuses: [DomainStatus::SERVER_RELEASE_PROHIBITED])
|
||||||
|
travel_to Time.zone.parse('2010-07-05')
|
||||||
|
|
||||||
|
Domain.release_domains
|
||||||
|
@domain.reload
|
||||||
|
|
||||||
assert_not @domain.discarded?
|
assert_not @domain.discarded?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue