mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 17:28:18 +02:00
Merge branch 'postalinfo'
Conflicts: app/helpers/epp/contacts_helper.rb app/models/address.rb app/models/contact.rb db/schema.rb spec/epp/contact_spec.rb spec/fabricators/contact_fabricator.rb spec/fabricators/international_address_fabricator.rb spec/models/address_spec.rb spec/models/contact_spec.rb
This commit is contained in:
commit
8d5152d400
17 changed files with 343 additions and 195 deletions
|
@ -7,13 +7,16 @@ end
|
|||
|
||||
describe Address, '.extract_params' do
|
||||
it 'returns params hash'do
|
||||
Fabricate(:country, iso: 'EE')
|
||||
ph = { postalInfo: { name: 'fred', addr: { cc: 'EE', city: 'Village', street: %w(street1 street2) } } }
|
||||
expect(Address.extract_attributes(ph[:postalInfo][:addr])).to eq({
|
||||
city: 'Village',
|
||||
country_id: 1,
|
||||
street: 'street1',
|
||||
street2: 'street2'
|
||||
Fabricate(:country, iso:'EE')
|
||||
ph = { postalInfo: { name: "fred", addr: { cc: 'EE', city: 'Village', street: [ 'street1', 'street2' ] } } }
|
||||
expect(Address.extract_attributes(ph[:postalInfo])).to eq( {
|
||||
international_address_attributes: {
|
||||
name: 'fred',
|
||||
city: 'Village',
|
||||
country_id: 1,
|
||||
street: 'street1',
|
||||
street2: 'street2',
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe Contact do
|
||||
it { should have_one(:address) }
|
||||
it { should have_one(:local_address) }
|
||||
it { should have_one(:international_address) }
|
||||
|
||||
context 'with invalid attribute' do
|
||||
before(:each) { @contact = Fabricate(:contact) }
|
||||
|
@ -22,7 +23,6 @@ describe Contact do
|
|||
|
||||
expect(@contact.errors.messages).to match_array({
|
||||
code: ['Required parameter missing - code'],
|
||||
name: ['Required parameter missing - name'],
|
||||
phone: ['Required parameter missing - phone', 'Phone nr is invalid'],
|
||||
email: ['Required parameter missing - email', 'Email is invalid'],
|
||||
ident: ['Required parameter missing - ident']
|
||||
|
@ -88,9 +88,8 @@ describe Contact, '.extract_params' do
|
|||
ph = { id: '123123', email: 'jdoe@example.com', postalInfo: { name: 'fred', addr: { cc: 'EE' } } }
|
||||
expect(Contact.extract_attributes(ph)).to eq({
|
||||
code: '123123',
|
||||
email: 'jdoe@example.com',
|
||||
name: 'fred'
|
||||
})
|
||||
email: 'jdoe@example.com'
|
||||
} )
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue