Merge pull request #868 from sgmap/fix-rna-missing-publication-date
If date_publication is missing on rna_information, do not crash
This commit is contained in:
commit
93b6f72161
2 changed files with 17 additions and 1 deletions
|
@ -62,7 +62,7 @@
|
||||||
%td= entreprise.rna_information.date_creation.strftime("%d/%m/%Y")
|
%td= entreprise.rna_information.date_creation.strftime("%d/%m/%Y")
|
||||||
%tr
|
%tr
|
||||||
%th Date de publication :
|
%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
|
%tr
|
||||||
%th Date de déclaration :
|
%th Date de déclaration :
|
||||||
%td= entreprise.rna_information.date_declaration.strftime("%d/%m/%Y")
|
%td= entreprise.rna_information.date_declaration.strftime("%d/%m/%Y")
|
||||||
|
|
|
@ -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
|
Loading…
Reference in a new issue