mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 13:44:47 +02:00
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:
commit
3029bd6c55
3 changed files with 18 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue