bug(normalized_address): should not raise an error for addresses without code postal
This commit is contained in:
parent
d8a0adc6ed
commit
eb3d2cb20c
1 changed files with 18 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe 'shared/dossiers/normalized_address', type: :view do
|
||||
before { render 'shared/dossiers/normalized_address', address: }
|
||||
let(:subject) { render 'shared/dossiers/normalized_address', address: }
|
||||
|
||||
context 'given an champ' do
|
||||
let(:procedure) { create(:procedure, types_de_champ_public: [{ type: :siret }]) }
|
||||
|
@ -10,7 +10,7 @@ describe 'shared/dossiers/normalized_address', type: :view do
|
|||
|
||||
it 'render address' do
|
||||
AddressProxy::ADDRESS_PARTS.each do |address_part|
|
||||
expect(rendered).to have_text(address_part)
|
||||
expect(subject).to have_text(address_part)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -20,12 +20,22 @@ describe 'shared/dossiers/normalized_address', type: :view do
|
|||
let(:address) { AddressProxy.new(etablissement) }
|
||||
|
||||
it 'render address' do
|
||||
expect(rendered).to have_text("6 RUE RAOUL NORDLING")
|
||||
expect(rendered).to have_text("BOIS COLOMBES 92270")
|
||||
expect(rendered).to have_text("92009")
|
||||
expect(rendered).to have_text("92270")
|
||||
expect(rendered).to have_text("Hauts-de-Seine – 92")
|
||||
expect(rendered).to have_text("Île-de-France – 11")
|
||||
expect(subject).to have_text("6 RUE RAOUL NORDLING")
|
||||
expect(subject).to have_text("BOIS COLOMBES 92270")
|
||||
expect(subject).to have_text("92009")
|
||||
expect(subject).to have_text("92270")
|
||||
expect(subject).to have_text("Hauts-de-Seine – 92")
|
||||
expect(subject).to have_text("Île-de-France – 11")
|
||||
end
|
||||
end
|
||||
|
||||
context 'given a partial etablissement address' do
|
||||
let(:etablissement) { create(:etablissement) }
|
||||
before { allow(etablissement).to receive(:code_postal).and_return(nil) }
|
||||
let(:address) { AddressProxy.new(etablissement) }
|
||||
|
||||
it 'render address' do
|
||||
expect { subject }.not_to raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue