diff --git a/app/views/new_gestionnaire/dossiers/_identite_entreprise.html.haml b/app/views/new_gestionnaire/dossiers/_identite_entreprise.html.haml index 0e090bac5..d3669980b 100644 --- a/app/views/new_gestionnaire/dossiers/_identite_entreprise.html.haml +++ b/app/views/new_gestionnaire/dossiers/_identite_entreprise.html.haml @@ -62,7 +62,7 @@ %td= entreprise.rna_information.date_creation.strftime("%d/%m/%Y") %tr %th Date de publication : - %td= entreprise.rna_information.date_publication.strftime("%d/%m/%Y") + %td= entreprise.rna_information.date_publication.try(:strftime, "%d/%m/%Y") %tr %th Date de déclaration : %td= entreprise.rna_information.date_declaration.strftime("%d/%m/%Y") diff --git a/spec/views/new_gestionnaire/dossiers/_identite_entreprise.html.haml_spec.rb b/spec/views/new_gestionnaire/dossiers/_identite_entreprise.html.haml_spec.rb new file mode 100644 index 000000000..73830217c --- /dev/null +++ b/spec/views/new_gestionnaire/dossiers/_identite_entreprise.html.haml_spec.rb @@ -0,0 +1,16 @@ +describe 'new_gestionnaire/dossiers/identite_entreprise.html.haml', type: :view do + before { render 'new_gestionnaire/dossiers/identite_entreprise.html.haml', entreprise: entreprise } + + context "there is an association" do + let(:rna_information) { create(:rna_information) } + let(:entreprise) { rna_information.entreprise } + + context "date_publication is missing on rna" do + before { rna_information.update_attributes(date_publication: nil) } + + it "can render without error" do + expect(rendered).to include("Date de publication :") + end + end + end +end