Update tag substitution concern
This commit is contained in:
parent
3f249d6663
commit
753a81c2d3
3 changed files with 7 additions and 9 deletions
|
@ -107,7 +107,7 @@ module TagsSubstitutionConcern
|
|||
{
|
||||
libelle: 'adresse',
|
||||
description: '',
|
||||
lambda: -> (e) { e&.etablissement&.inline_adresse },
|
||||
target: :inline_adresse,
|
||||
available_for_states: Dossier::SOUMIS
|
||||
}
|
||||
]
|
||||
|
@ -187,7 +187,7 @@ module TagsSubstitutionConcern
|
|||
tags_and_datas = [
|
||||
[dossier_tags, dossier],
|
||||
[INDIVIDUAL_TAGS, dossier.individual],
|
||||
[ENTREPRISE_TAGS, dossier.entreprise]
|
||||
[ENTREPRISE_TAGS, dossier.etablissement&.entreprise]
|
||||
]
|
||||
|
||||
tags_and_datas
|
||||
|
|
|
@ -98,11 +98,10 @@ describe AttestationTemplate, type: :model do
|
|||
end
|
||||
let(:for_individual) { false }
|
||||
let(:individual) { nil }
|
||||
let(:etablissement) { nil }
|
||||
let(:entreprise) { create(:entreprise, etablissement: etablissement) }
|
||||
let(:etablissement) { create(:etablissement) }
|
||||
let(:types_de_champ) { [] }
|
||||
let(:types_de_champ_private) { [] }
|
||||
let!(:dossier) { create(:dossier, procedure: procedure, individual: individual, entreprise: entreprise) }
|
||||
let!(:dossier) { create(:dossier, procedure: procedure, individual: individual, etablissement: etablissement) }
|
||||
let(:template_title) { 'title' }
|
||||
let(:template_body) { 'body' }
|
||||
let(:attestation_template) do
|
||||
|
|
|
@ -30,9 +30,8 @@ describe TagsSubstitutionConcern, type: :model do
|
|||
|
||||
describe 'replace_tags' do
|
||||
let(:individual) { nil }
|
||||
let(:etablissement) { nil }
|
||||
let(:entreprise) { create(:entreprise, etablissement: etablissement) }
|
||||
let!(:dossier) { create(:dossier, procedure: procedure, individual: individual, entreprise: entreprise) }
|
||||
let(:etablissement) { create(:etablissement) }
|
||||
let!(:dossier) { create(:dossier, procedure: procedure, individual: individual, etablissement: etablissement) }
|
||||
|
||||
before { Timecop.freeze(Time.now) }
|
||||
|
||||
|
@ -61,7 +60,7 @@ describe TagsSubstitutionConcern, type: :model do
|
|||
let(:etablissement) { create(:etablissement) }
|
||||
|
||||
let(:expected_text) do
|
||||
"#{entreprise.siren} #{entreprise.numero_tva_intracommunautaire} #{entreprise.siret_siege_social} #{entreprise.raison_sociale} #{etablissement.inline_adresse}"
|
||||
"#{etablissement.entreprise_siren} #{etablissement.entreprise_numero_tva_intracommunautaire} #{etablissement.entreprise_siret_siege_social} #{etablissement.entreprise_raison_sociale} #{etablissement.inline_adresse}"
|
||||
end
|
||||
|
||||
it { is_expected.to eq(expected_text) }
|
||||
|
|
Loading…
Reference in a new issue