Skip to content

Commit

Permalink
Merge pull request #2017 from internetee/2016-check-auction-before-se…
Browse files Browse the repository at this point in the history
…nding-domain

Do not create auction on domain release if already exists
  • Loading branch information
vohmar authored Jun 1, 2021
2 parents 5e5a38e + 445cff4 commit f808a55
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/dns/domain_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def to_s
attr_reader :name

def not_auctionable?
blocked? || reserved? || disputed?
blocked? || reserved? || disputed? || pending_auction.present?
end

def zone_with_same_origin?
Expand Down
15 changes: 15 additions & 0 deletions test/models/domain/releasable/auctionable_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ def test_skips_auction_when_domains_is_blocked
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')
Expand Down

0 comments on commit f808a55

Please sign in to comment.