diff --git a/app/views/dossiers/show.pdf.prawn b/app/views/dossiers/show.pdf.prawn index 244bfd352..475bf1274 100644 --- a/app/views/dossiers/show.pdf.prawn +++ b/app/views/dossiers/show.pdf.prawn @@ -9,7 +9,7 @@ def format_in_2_lines(pdf, label, text) end def render_box(pdf, text, x, width) - box = ::Prawn::Text::Box.new(text || '', { document: pdf, width: width, overflow: :expand, at: [x, pdf.cursor] }) + box = ::Prawn::Text::Box.new(text.to_s, { document: pdf, width: width, overflow: :expand, at: [x, pdf.cursor] }) box.render box.height end diff --git a/spec/controllers/instructeurs/dossiers_controller_spec.rb b/spec/controllers/instructeurs/dossiers_controller_spec.rb index ab48d0bb1..88a228c27 100644 --- a/spec/controllers/instructeurs/dossiers_controller_spec.rb +++ b/spec/controllers/instructeurs/dossiers_controller_spec.rb @@ -526,16 +526,19 @@ describe Instructeurs::DossiersController, type: :controller do describe "#show" do context "when the dossier is exported as PDF" do let(:instructeur) { create(:instructeur) } - let(:dossier) { - create(:dossier, - :accepte, - :with_all_champs, - :with_all_annotations, - :with_motivation, - :with_commentaires, procedure: procedure) -} - let!(:avis) { create(:avis, dossier: dossier, instructeur: instructeur) } + let(:dossier) do + create(:dossier, + :accepte, + :with_all_champs, + :with_all_annotations, + :with_motivation, + :with_entreprise, + :with_commentaires, procedure: procedure) + end + let(:avis) { create(:avis, dossier: dossier, instructeur: instructeur) } + subject do + avis get :show, params: { procedure_id: procedure.id, dossier_id: dossier.id, @@ -543,9 +546,8 @@ describe Instructeurs::DossiersController, type: :controller do } end - before do - subject - end + before { subject } + it { expect(assigns(:include_infos_administration)).to eq(true) } it { expect(response).to render_template 'dossiers/show' } end