dossier: fix PDF rendering of effectif_mensuel
The effectif_mensuel was a number, it needs to be converted explicitely into a string. As a bonus, `nil.to_s` is `""`, so we can remove the special case for nil.
This commit is contained in:
parent
060bf1f9ca
commit
975d1648d5
2 changed files with 15 additions and 13 deletions
|
@ -9,7 +9,7 @@ def format_in_2_lines(pdf, label, text)
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_box(pdf, text, x, width)
|
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.render
|
||||||
box.height
|
box.height
|
||||||
end
|
end
|
||||||
|
|
|
@ -526,16 +526,19 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
describe "#show" do
|
describe "#show" do
|
||||||
context "when the dossier is exported as PDF" do
|
context "when the dossier is exported as PDF" do
|
||||||
let(:instructeur) { create(:instructeur) }
|
let(:instructeur) { create(:instructeur) }
|
||||||
let(:dossier) {
|
let(:dossier) do
|
||||||
create(:dossier,
|
create(:dossier,
|
||||||
:accepte,
|
:accepte,
|
||||||
:with_all_champs,
|
:with_all_champs,
|
||||||
:with_all_annotations,
|
:with_all_annotations,
|
||||||
:with_motivation,
|
:with_motivation,
|
||||||
|
:with_entreprise,
|
||||||
:with_commentaires, procedure: procedure)
|
:with_commentaires, procedure: procedure)
|
||||||
}
|
end
|
||||||
let!(:avis) { create(:avis, dossier: dossier, instructeur: instructeur) }
|
let(:avis) { create(:avis, dossier: dossier, instructeur: instructeur) }
|
||||||
|
|
||||||
subject do
|
subject do
|
||||||
|
avis
|
||||||
get :show, params: {
|
get :show, params: {
|
||||||
procedure_id: procedure.id,
|
procedure_id: procedure.id,
|
||||||
dossier_id: dossier.id,
|
dossier_id: dossier.id,
|
||||||
|
@ -543,9 +546,8 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before { subject }
|
||||||
subject
|
|
||||||
end
|
|
||||||
it { expect(assigns(:include_infos_administration)).to eq(true) }
|
it { expect(assigns(:include_infos_administration)).to eq(true) }
|
||||||
it { expect(response).to render_template 'dossiers/show' }
|
it { expect(response).to render_template 'dossiers/show' }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue