Skip to content

Commit

Permalink
Add address processing to contact model
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Beljajev committed Dec 1, 2016
1 parent fb58477 commit e4ae71b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/models/contact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,20 @@ def names
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
Expand Down
23 changes: 23 additions & 0 deletions spec/models/contact_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -383,4 +383,27 @@
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

0 comments on commit e4ae71b

Please sign in to comment.