Do not create auction on domain release if already exists

Closes #2015
This commit is contained in:
Alex Sherman 2021-06-01 17:52:04 +05:00
parent 5e5a38eb8e
commit 445cff4a29
2 changed files with 16 additions and 1 deletions

View file

@ -86,7 +86,7 @@ module DNS
attr_reader :name
def not_auctionable?
blocked? || reserved? || disputed?
blocked? || reserved? || disputed? || pending_auction.present?
end
def zone_with_same_origin?

View file

@ -32,6 +32,21 @@ class DomainReleasableAuctionableTest < ActiveJob::TestCase
assert_not @domain.domain_name.at_auction?
end
def test_skips_auction_when_auction_present
assert_equal 'shop.test', @domain.name
Auction.create!(domain: @domain.name, status: Auction.statuses[:started])
assert_difference '@domain.registrar.notifications.count', 1 do
assert_no_difference 'Auction.count' do
@domain.release
end
end
assert_raises ActiveRecord::RecordNotFound do
@domain.reload
end
end
def test_skips_auction_when_domains_is_reserved
assert_equal 'shop.test', @domain.name
reserved_domains(:one).update!(name: 'shop.test')