mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 00:42:04 +02:00
Merge branch 'master' into registry-693
# Conflicts: # app/api/repp/domain_transfers_v1.rb
This commit is contained in:
commit
1fad07963f
41 changed files with 524 additions and 285 deletions
|
@ -1,6 +1,6 @@
|
|||
require 'test_helper'
|
||||
|
||||
class DomainTransferTest < ActiveSupport::TestCase
|
||||
class DomainTransferableTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
@domain = domains(:shop)
|
||||
@new_registrar = registrars(:goodnames)
|
||||
|
@ -44,22 +44,4 @@ class DomainTransferTest < ActiveSupport::TestCase
|
|||
@domain.transfer(@new_registrar)
|
||||
refute_same old_transfer_code, @domain.transfer_code
|
||||
end
|
||||
|
||||
def test_creates_domain_transfer
|
||||
assert_difference 'DomainTransfer.count' do
|
||||
@domain.transfer(@new_registrar)
|
||||
end
|
||||
end
|
||||
|
||||
def test_creates_message
|
||||
assert_difference 'Message.count' do
|
||||
@domain.transfer(@new_registrar)
|
||||
end
|
||||
end
|
||||
|
||||
def test_copies_contacts
|
||||
assert_difference 'Contact.count', 2 do
|
||||
@domain.transfer(@new_registrar)
|
||||
end
|
||||
end
|
||||
end
|
32
test/models/domain_transfer_test.rb
Normal file
32
test/models/domain_transfer_test.rb
Normal file
|
@ -0,0 +1,32 @@
|
|||
require 'test_helper'
|
||||
|
||||
class DomainTransferTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
@domain_transfer = domain_transfers(:shop)
|
||||
end
|
||||
|
||||
def test_approval
|
||||
@domain_transfer.approve
|
||||
@domain_transfer.reload
|
||||
assert @domain_transfer.approved?
|
||||
end
|
||||
|
||||
def test_notifies_old_registrar_on_approval
|
||||
old_registrar = @domain_transfer.old_registrar
|
||||
|
||||
assert_difference -> { old_registrar.messages.count } do
|
||||
@domain_transfer.approve
|
||||
end
|
||||
|
||||
body = 'Transfer of domain shop.test has been approved.' \
|
||||
' It was associated with registrant john-001' \
|
||||
' and contacts jane-001, william-001.'
|
||||
id = @domain_transfer.id
|
||||
class_name = @domain_transfer.class.name
|
||||
|
||||
message = old_registrar.messages.last
|
||||
assert_equal body, message.body
|
||||
assert_equal id, message.attached_obj_id
|
||||
assert_equal class_name, message.attached_obj_type
|
||||
end
|
||||
end
|
21
test/models/message_test.rb
Normal file
21
test/models/message_test.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
require 'test_helper'
|
||||
|
||||
class MessageTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
@message = messages(:greeting)
|
||||
end
|
||||
|
||||
def test_valid
|
||||
assert @message.valid?
|
||||
end
|
||||
|
||||
def test_invalid_without_body
|
||||
@message.body = nil
|
||||
assert @message.invalid?
|
||||
end
|
||||
|
||||
def test_invalid_without_registrar
|
||||
@message.registrar = nil
|
||||
assert @message.invalid?
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue