fix(spec): missed a failed spec previously. sorry

This commit is contained in:
Martin 2022-10-06 15:04:59 +02:00
parent 8a3550cda4
commit a256dfbaa0
3 changed files with 5 additions and 2 deletions

View file

@ -489,6 +489,7 @@ class Procedure < ApplicationRecord
procedure.duree_conservation_etendue_par_ds = false procedure.duree_conservation_etendue_par_ds = false
if procedure.duree_conservation_dossiers_dans_ds > NEW_MAX_DUREE_CONSERVATION if procedure.duree_conservation_dossiers_dans_ds > NEW_MAX_DUREE_CONSERVATION
procedure.duree_conservation_dossiers_dans_ds = NEW_MAX_DUREE_CONSERVATION procedure.duree_conservation_dossiers_dans_ds = NEW_MAX_DUREE_CONSERVATION
procedure.max_duree_conservation_dossiers_dans_ds = NEW_MAX_DUREE_CONSERVATION
end end
procedure.published_revision = nil procedure.published_revision = nil
procedure.draft_revision.procedure = procedure procedure.draft_revision.procedure = procedure

View file

@ -9,6 +9,7 @@ FactoryBot.define do
cadre_juridique { "un cadre juridique important" } cadre_juridique { "un cadre juridique important" }
published_at { nil } published_at { nil }
duree_conservation_dossiers_dans_ds { 3 } duree_conservation_dossiers_dans_ds { 3 }
max_duree_conservation_dossiers_dans_ds { Procedure::OLD_MAX_DUREE_CONSERVATION }
ask_birthday { false } ask_birthday { false }
lien_site_web { "https://mon-site.gouv" } lien_site_web { "https://mon-site.gouv" }
path { SecureRandom.uuid } path { SecureRandom.uuid }

View file

@ -284,7 +284,7 @@ describe Procedure do
describe 'duree de conservation dans ds' do describe 'duree de conservation dans ds' do
let(:field_name) { :duree_conservation_dossiers_dans_ds } let(:field_name) { :duree_conservation_dossiers_dans_ds }
context 'by default is caped to 12' do context 'by default is caped to 12' do
subject { create(:procedure, duree_conservation_dossiers_dans_ds: 12) } subject { create(:procedure, duree_conservation_dossiers_dans_ds: 12, max_duree_conservation_dossiers_dans_ds: 12) }
it { is_expected.not_to allow_value(nil).for(field_name) } it { is_expected.not_to allow_value(nil).for(field_name) }
it { is_expected.not_to allow_value('').for(field_name) } it { is_expected.not_to allow_value('').for(field_name) }
it { is_expected.not_to allow_value('trois').for(field_name) } it { is_expected.not_to allow_value('trois').for(field_name) }
@ -448,6 +448,7 @@ describe Procedure do
opendata: opendata, opendata: opendata,
duree_conservation_etendue_par_ds: true, duree_conservation_etendue_par_ds: true,
duree_conservation_dossiers_dans_ds: Procedure::OLD_MAX_DUREE_CONSERVATION, duree_conservation_dossiers_dans_ds: Procedure::OLD_MAX_DUREE_CONSERVATION,
max_duree_conservation_dossiers_dans_ds: Procedure::OLD_MAX_DUREE_CONSERVATION,
attestation_template: build(:attestation_template, logo: logo, signature: signature), attestation_template: build(:attestation_template, logo: logo, signature: signature),
types_de_champ_public: [{}, {}, { type: :drop_down_list }, { type: :piece_justificative }, { type: :repetition, children: [{}] }], types_de_champ_public: [{}, {}, { type: :drop_down_list }, { type: :piece_justificative }, { type: :repetition, children: [{}] }],
types_de_champ_private: [{}, {}, { type: :drop_down_list }, { type: :repetition, children: [{}] }], types_de_champ_private: [{}, {}, { type: :drop_down_list }, { type: :repetition, children: [{}] }],
@ -531,7 +532,7 @@ describe Procedure do
cloned_procedure = subject cloned_procedure = subject
cloned_procedure.parent_procedure_id = nil cloned_procedure.parent_procedure_id = nil
expect(cloned_procedure).to have_same_attributes_as(procedure, except: ["path", "draft_revision_id", "service_id", "duree_conservation_etendue_par_ds", "duree_conservation_dossiers_dans_ds"]) expect(cloned_procedure).to have_same_attributes_as(procedure, except: ["path", "draft_revision_id", "service_id", "duree_conservation_etendue_par_ds", "duree_conservation_dossiers_dans_ds", 'max_duree_conservation_dossiers_dans_ds'])
end end
context 'which is opendata' do context 'which is opendata' do