Merge pull request #5331 from betagouv/fix-numbers-rendering
Correction des exports PDF des dossiers, dans le cas où l'effectif mensuel était présent
This commit is contained in:
commit
612c826d04
5 changed files with 22 additions and 15 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_commentaires, procedure: procedure)
|
:with_entreprise,
|
||||||
}
|
:with_commentaires, procedure: procedure)
|
||||||
let!(:avis) { create(:avis, dossier: dossier, instructeur: instructeur) }
|
end
|
||||||
|
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
|
||||||
|
|
|
@ -28,7 +28,7 @@ FactoryBot.define do
|
||||||
if dossier.procedure.for_individual?
|
if dossier.procedure.for_individual?
|
||||||
raise 'Inconsistent factory: attempting to create a dossier :with_entreprise on a procedure that is `for_individual?`'
|
raise 'Inconsistent factory: attempting to create a dossier :with_entreprise on a procedure that is `for_individual?`'
|
||||||
end
|
end
|
||||||
etablissement = create(:etablissement)
|
etablissement = create(:etablissement, :with_exercices, :with_effectif_mensuel)
|
||||||
dossier.etablissement = etablissement
|
dossier.etablissement = etablissement
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,6 +30,12 @@ FactoryBot.define do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
trait :with_effectif_mensuel do
|
||||||
|
entreprise_effectif_mensuel { 100.5 }
|
||||||
|
entreprise_effectif_mois { '03' }
|
||||||
|
entreprise_effectif_annee { '2020' }
|
||||||
|
end
|
||||||
|
|
||||||
trait :non_diffusable do
|
trait :non_diffusable do
|
||||||
diffusable_commercialement { false }
|
diffusable_commercialement { false }
|
||||||
end
|
end
|
||||||
|
|
|
@ -223,7 +223,6 @@ describe Dossier do
|
||||||
|
|
||||||
describe '#reset!' do
|
describe '#reset!' do
|
||||||
let!(:dossier) { create :dossier, :with_entreprise, autorisation_donnees: true }
|
let!(:dossier) { create :dossier, :with_entreprise, autorisation_donnees: true }
|
||||||
let!(:exercice) { create :exercice, etablissement: dossier.etablissement }
|
|
||||||
|
|
||||||
subject { dossier.reset! }
|
subject { dossier.reset! }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue