gestionnaire: fix dossier printing page

Fix the invalid template, and add tests.
This commit is contained in:
Pierre de La Morinerie 2018-09-05 16:17:26 +02:00
parent 9fdd528619
commit 19908ede25
3 changed files with 8 additions and 2 deletions

View file

@ -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();

View file

@ -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)

View file

@ -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)