Introduce kind and reg_no contact's attributes

#266
This commit is contained in:
Artur Beljajev 2016-12-22 16:34:29 +02:00
parent 16ebdc6c90
commit e6069e06a9
3 changed files with 33 additions and 0 deletions

View file

@ -361,6 +361,8 @@ describe Contact, '.destroy_orphans' do
end
RSpec.describe Contact, db: false do
it { is_expected.to alias_attribute(:kind, :ident_type) }
describe '::names' do
before :example do
expect(described_class).to receive(:pluck).with(:name).and_return('names')
@ -463,4 +465,20 @@ RSpec.describe Contact, db: false do
expect(address_removed).to be_truthy
end
end
describe '#reg_no' do
subject(:reg_no) { contact.reg_no }
context 'when contact is legal entity' do
let(:contact) { FactoryGirl.build_stubbed(:contact_legal_entity, ident: '1234') }
specify { expect(reg_no).to eq('1234') }
end
context 'when contact is private entity' do
let(:contact) { FactoryGirl.build_stubbed(:contact_private_entity, ident: '1234') }
specify { expect(reg_no).to be_nil }
end
end
end