mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 21:25:39 +02:00
Use the same serializer for all contact related actions
Also, rerun the response with an RFC4627 formatter
This commit is contained in:
parent
2a7b6c1eb8
commit
94efbbbab0
5 changed files with 146 additions and 105 deletions
26
test/lib/serializers/registrant_api/contact_test.rb
Normal file
26
test/lib/serializers/registrant_api/contact_test.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
require 'test_helper'
|
||||
require 'serializers/registrant_api/contact'
|
||||
|
||||
class SerializersRegistrantApiContactTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
@contact = contacts(:william)
|
||||
@serializer = Serializers::RegistrantApi::Contact.new(@contact)
|
||||
@json = @serializer.to_json
|
||||
end
|
||||
|
||||
def test_returns_uuid_as_id
|
||||
assert_equal(@contact.uuid, @json[:id])
|
||||
end
|
||||
|
||||
def test_returns_indent_as_separate_object
|
||||
expected_ident = { code: @contact.ident, type: @contact.ident_type,
|
||||
country_code: @contact.ident_country_code }
|
||||
assert_equal(expected_ident, @json[:ident])
|
||||
end
|
||||
|
||||
def test_returns_address_as_separate_object
|
||||
expected_address = { street: @contact.street, zip: @contact.zip, city: @contact.city,
|
||||
state: @contact.state, country_code: @contact.country_code }
|
||||
assert_equal(expected_address, @json[:address])
|
||||
end
|
||||
end
|
|
@ -1,7 +1,7 @@
|
|||
require 'test_helper'
|
||||
require 'serializers/registrant_api/domain'
|
||||
|
||||
class SerializersRegistrantApiDomainTest < ApplicationIntegrationTest
|
||||
class SerializersRegistrantApiDomainTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
@domain = domains(:airport)
|
||||
@serializer = Serializers::RegistrantApi::Domain.new(@domain)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue