Etablissement: add inline_adresse

This commit is contained in:
Simon Lehericey 2017-06-22 14:58:29 +02:00
parent eb0ddbdba6
commit d69d0f8a78
2 changed files with 11 additions and 0 deletions

View file

@ -9,4 +9,9 @@ class Etablissement < ActiveRecord::Base
def geo_adresse
[numero_voie, type_voie, nom_voie, complement_adresse, code_postal, localite].join(' ')
end
def inline_adresse
#squeeze needed because of space in excess in the data
"#{numero_voie} #{type_voie} #{nom_voie}, #{complement_adresse}, #{code_postal} #{localite}".squeeze(' ')
end
end

View file

@ -29,4 +29,10 @@ describe Etablissement do
it { is_expected.to eq '6 RUE RAOUL NORDLING IMMEUBLE BORA 92270 BOIS COLOMBES' }
end
describe '#inline_adresse' do
let(:etablissement) { create(:etablissement, nom_voie: 'green moon') }
it { expect(etablissement.inline_adresse).to eq '6 RUE green moon, IMMEUBLE BORA, 92270 BOIS COLOMBES' }
end
end