Merge pull request #2017 from internetee/2016-check-auction-before-sending-domain

Do not create auction on domain release if already exists
This commit is contained in:
Timo Võhmar 2021-06-01 18:15:27 +03:00 committed by GitHub
commit f808a55e9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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')