Merge pull request #1097 from internetee/fix-auction-integration

Fix WHOIS update for a domain being sent to an auction
This commit is contained in:
Timo Võhmar 2019-03-12 16:31:26 +02:00 committed by GitHub
commit 3029bd6c55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 3 deletions

View file

@ -35,8 +35,10 @@ module Concerns
def release
if release_to_auction
domain_name.sell_at_auction
destroy!
transaction do
domain_name.sell_at_auction
destroy!
end
else
discard
end

View file

@ -93,7 +93,7 @@ class Domain < ActiveRecord::Base
true
end
after_commit :update_whois_record
after_commit :update_whois_record, unless: 'domain_name.at_auction?'
after_create :update_reserved_domains
def update_reserved_domains

View file

@ -1,6 +1,9 @@
require 'test_helper'
class DomainReleasableAuctionableTest < ActiveSupport::TestCase
# Needed for `test_updates_whois` test because of `after_commit :update_whois_record` in Domain
self.use_transactional_fixtures = false
setup do
@domain = domains(:shop)
Domain.release_to_auction = true
@ -28,6 +31,16 @@ class DomainReleasableAuctionableTest < ActiveSupport::TestCase
end
end
def test_updates_whois
assert_equal 'shop.test', @domain.name
@domain.update!(delete_at: Time.zone.parse('2010-07-05 07:59'))
travel_to Time.zone.parse('2010-07-05 08:00')
Domain.release_domains
assert Whois::Record.find_by(name: 'shop.test')
end
def test_ignores_domains_with_delete_at_in_the_future_or_now
@domain.update!(delete_at: Time.zone.parse('2010-07-05 08:00'))
travel_to Time.zone.parse('2010-07-05 08:00')