mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
21 lines
552 B
Ruby
21 lines
552 B
Ruby
require 'rails_helper'
|
|
|
|
describe Address do
|
|
it { should belong_to(:contact) }
|
|
it { should belong_to(:country) }
|
|
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])).to eq({
|
|
address_attributes: {
|
|
city: 'Village',
|
|
country_id: 1,
|
|
street: 'street1',
|
|
street2: 'street2'
|
|
}
|
|
})
|
|
end
|
|
end
|