Merge pull request #10405 from demarches-simplifiees/feat/10403
BUGFIX : La démarche modèle clonée n'est plus modèle
This commit is contained in:
commit
57c0fa0933
2 changed files with 8 additions and 2 deletions
|
@ -550,6 +550,7 @@ class Procedure < ApplicationRecord
|
||||||
procedure.closing_details = nil
|
procedure.closing_details = nil
|
||||||
procedure.closing_notification_brouillon = false
|
procedure.closing_notification_brouillon = false
|
||||||
procedure.closing_notification_en_cours = false
|
procedure.closing_notification_en_cours = false
|
||||||
|
procedure.template = false
|
||||||
|
|
||||||
if !procedure.valid?
|
if !procedure.valid?
|
||||||
procedure.errors.attribute_names.each do |attribute|
|
procedure.errors.attribute_names.each do |attribute|
|
||||||
|
|
|
@ -587,7 +587,8 @@ describe Procedure do
|
||||||
types_de_champ_private: [{}, {}, { type: :drop_down_list }, { type: :repetition, children: [{}] }],
|
types_de_champ_private: [{}, {}, { type: :drop_down_list }, { type: :repetition, children: [{}] }],
|
||||||
api_particulier_token: '123456789012345',
|
api_particulier_token: '123456789012345',
|
||||||
api_particulier_scopes: ['cnaf_famille'],
|
api_particulier_scopes: ['cnaf_famille'],
|
||||||
estimated_dossiers_count: 4)
|
estimated_dossiers_count: 4,
|
||||||
|
template: true)
|
||||||
end
|
end
|
||||||
let(:type_de_champ_repetition) { procedure.draft_revision.types_de_champ_public.last }
|
let(:type_de_champ_repetition) { procedure.draft_revision.types_de_champ_public.last }
|
||||||
let(:type_de_champ_private_repetition) { procedure.draft_revision.types_de_champ_private.last }
|
let(:type_de_champ_private_repetition) { procedure.draft_revision.types_de_champ_private.last }
|
||||||
|
@ -612,6 +613,10 @@ describe Procedure do
|
||||||
|
|
||||||
it { expect(subject.parent_procedure).to eq(procedure) }
|
it { expect(subject.parent_procedure).to eq(procedure) }
|
||||||
|
|
||||||
|
it 'the cloned procedure should not be a template anymore' do
|
||||||
|
expect(subject.template).to be_falsey
|
||||||
|
end
|
||||||
|
|
||||||
describe "should keep groupe instructeurs " do
|
describe "should keep groupe instructeurs " do
|
||||||
it "should clone groupe instructeurs" do
|
it "should clone groupe instructeurs" do
|
||||||
expect(subject.groupe_instructeurs.size).to eq(2)
|
expect(subject.groupe_instructeurs.size).to eq(2)
|
||||||
|
@ -680,7 +685,7 @@ describe Procedure do
|
||||||
expect(cloned_procedure).to have_same_attributes_as(procedure, except: [
|
expect(cloned_procedure).to have_same_attributes_as(procedure, except: [
|
||||||
"path", "draft_revision_id", "service_id", 'estimated_dossiers_count',
|
"path", "draft_revision_id", "service_id", 'estimated_dossiers_count',
|
||||||
"duree_conservation_etendue_par_ds", "duree_conservation_dossiers_dans_ds", 'max_duree_conservation_dossiers_dans_ds',
|
"duree_conservation_etendue_par_ds", "duree_conservation_dossiers_dans_ds", 'max_duree_conservation_dossiers_dans_ds',
|
||||||
"defaut_groupe_instructeur_id"
|
"defaut_groupe_instructeur_id", "template"
|
||||||
])
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue