Add address processing to contact model

#251
This commit is contained in:
Artur Beljajev 2016-12-02 00:21:52 +02:00
parent fb584778fd
commit e4ae71b308
2 changed files with 37 additions and 0 deletions

View file

@ -257,6 +257,20 @@ class Contact < ActiveRecord::Base
def emails
pluck(:email)
end
def address_processing
Setting.address_processing
end
def address_attributes
%i(
city
street
zip
country_code
state
)
end
end
def roid

View file

@ -383,4 +383,27 @@ RSpec.describe Contact, db: false do
expect(described_class.emails).to eq('emails')
end
end
describe '::address_processing' do
before do
Setting.address_processing = 'test'
end
it 'returns setting value' do
expect(described_class.address_processing).to eq('test')
end
end
describe '::address_attributes', db: false do
it 'returns address attributes' do
attributes = %i(
city
street
zip
country_code
state
)
expect(described_class.address_attributes).to eq(attributes)
end
end
end