Merge pull request #9748 from colinux/fix-etablissement-non-diffusable

ETQ usager on ne m'affiche plus la raison sociale d'un établissement non diffusible
This commit is contained in:
Colin Darie 2023-11-27 13:51:54 +00:00 committed by GitHub
commit 3869dd3a92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 6 deletions

View file

@ -109,13 +109,15 @@ module DossierHelper
def demandeur_dossier(dossier)
if dossier.procedure.for_individual?
"#{dossier&.individual&.nom} #{dossier&.individual&.prenom}"
return "#{dossier&.individual&.nom} #{dossier&.individual&.prenom}"
end
return "" if dossier.etablissement.blank?
if dossier.etablissement.diffusable_commercialement == false
"SIRET #{pretty_siret(dossier.etablissement.siret)}"
else
if dossier.etablissement.present?
raison_sociale_or_name(dossier.etablissement)
else
""
end
raison_sociale_or_name(dossier.etablissement)
end
end

View file

@ -69,6 +69,12 @@ RSpec.describe DossierHelper, type: :helper do
context "when the company has name information" do
it { is_expected.to eq raison_sociale_or_name(etablissement) }
end
context "when the company is not diffusable" do
let(:etablissement) { build(:etablissement, :non_diffusable, siret: "12345678901234") }
it { is_expected.to include("123 456 789 01234") }
end
end
end