Merge pull request #9294 from colinux/fix-entreprise-without-siret-siege
Fix (demande): pas d'erreur lorsque l'entreprie n'a pas de SIRET associé au siège social
This commit is contained in:
commit
e2a9978c26
2 changed files with 31 additions and 1 deletions
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
- unless local_assigns[:short_identity]
|
- unless local_assigns[:short_identity]
|
||||||
- if etablissement.siret != etablissement.entreprise.siret_siege_social
|
- if etablissement.entreprise.siret_siege_social.present? && etablissement.siret != etablissement.entreprise.siret_siege_social
|
||||||
= render Dossiers::RowShowComponent.new(label: "SIRET du siège social") do |c|
|
= render Dossiers::RowShowComponent.new(label: "SIRET du siège social") do |c|
|
||||||
- c.with_value do
|
- c.with_value do
|
||||||
%p
|
%p
|
||||||
|
|
|
@ -56,5 +56,35 @@ describe 'shared/dossiers/identite_entreprise', type: :view do
|
||||||
expect(rendered).to include("9 001")
|
expect(rendered).to include("9 001")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'siret siege social' do
|
||||||
|
let(:etablissement) { create(:etablissement, siret: "12345678900001", entreprise_siret_siege_social: siret_siege_social) }
|
||||||
|
|
||||||
|
context 'when siege social has same siret' do
|
||||||
|
let(:siret_siege_social) { "12345678900001" }
|
||||||
|
|
||||||
|
it 'does not duplicate siret' do
|
||||||
|
expect(subject).to include("123 456 789 00001").once
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when siege social is different' do
|
||||||
|
let(:siret_siege_social) { "98765432100001" }
|
||||||
|
|
||||||
|
it 'shows both sirets' do
|
||||||
|
expect(subject).to include("123 456 789 00001")
|
||||||
|
expect(subject).to include("SIRET du siège social")
|
||||||
|
expect(subject).to include("987 654 321 00001")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when siege social has no siret' do
|
||||||
|
let(:siret_siege_social) { nil }
|
||||||
|
|
||||||
|
it 'does not duplicate siret' do
|
||||||
|
expect(subject).not_to include("SIRET du siège social")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue