From 19908ede25c6ffc23a4f709422b7d7986fc8781f Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Wed, 5 Sep 2018 16:17:26 +0200 Subject: [PATCH] gestionnaire: fix dossier printing page Fix the invalid template, and add tests. --- app/views/new_gestionnaire/dossiers/print.html.haml | 2 +- spec/factories/dossier.rb | 6 ++++++ .../views/new_gestionnaire/dossiers/print.html.haml_spec.rb | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/views/new_gestionnaire/dossiers/print.html.haml b/app/views/new_gestionnaire/dossiers/print.html.haml index 69fab09cc..dbffd5ec5 100644 --- a/app/views/new_gestionnaire/dossiers/print.html.haml +++ b/app/views/new_gestionnaire/dossiers/print.html.haml @@ -84,7 +84,7 @@ %ul.messages-list - @dossier.commentaires.each do |commentaire| %li - = render partial: "new_gestionnaire/shared/messages/message", locals: { commentaire: commentaire, user_email: current_gestionnaire.email, messagerie_seen_at: nil } + = render partial: "shared/dossiers/messages/message", locals: { commentaire: commentaire, user_email: current_gestionnaire.email, messagerie_seen_at: nil } %script{ type: "text/javascript" } window.print(); diff --git a/spec/factories/dossier.rb b/spec/factories/dossier.rb index 9cb453142..cb159e899 100644 --- a/spec/factories/dossier.rb +++ b/spec/factories/dossier.rb @@ -64,6 +64,12 @@ FactoryBot.define do end end + trait :with_commentaires do + after(:create) do |dossier, _evaluator| + dossier.commentaires += create_list(:commentaire, 2) + end + end + trait :followed do after(:create) do |dossier, _evaluator| g = create(:gestionnaire) diff --git a/spec/views/new_gestionnaire/dossiers/print.html.haml_spec.rb b/spec/views/new_gestionnaire/dossiers/print.html.haml_spec.rb index 02b6e755d..1aaf41029 100644 --- a/spec/views/new_gestionnaire/dossiers/print.html.haml_spec.rb +++ b/spec/views/new_gestionnaire/dossiers/print.html.haml_spec.rb @@ -3,7 +3,7 @@ describe 'new_gestionnaire/dossiers/print.html.haml', type: :view do context "with a dossier" do let(:current_gestionnaire) { create(:gestionnaire) } - let(:dossier) { create(:dossier, :en_instruction) } + let(:dossier) { create(:dossier, :en_instruction, :with_commentaires) } before do assign(:dossier, dossier)