From f4977f358b3a55369e7d36950ddf4f741ca5c5c6 Mon Sep 17 00:00:00 2001 From: Christophe Robillard Date: Tue, 20 Dec 2022 17:22:19 +0100 Subject: [PATCH] fix spec procedure_cloning add zone to new procedure --- spec/factories/procedure.rb | 9 +++++++++ spec/system/administrateurs/procedure_cloning_spec.rb | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/spec/factories/procedure.rb b/spec/factories/procedure.rb index 544029c75..cd947cf18 100644 --- a/spec/factories/procedure.rb +++ b/spec/factories/procedure.rb @@ -116,6 +116,15 @@ FactoryBot.define do end end + trait :with_zone do + zones { + [ + create(:zone, labels: + [{ designated_on: Time.zone.now, name: "Ministère 1" }]) + ] + } + end + trait :routee do after(:create) do |procedure, _evaluator| procedure.groupe_instructeurs.create(label: 'deuxième groupe') diff --git a/spec/system/administrateurs/procedure_cloning_spec.rb b/spec/system/administrateurs/procedure_cloning_spec.rb index afba00816..945cb514e 100644 --- a/spec/system/administrateurs/procedure_cloning_spec.rb +++ b/spec/system/administrateurs/procedure_cloning_spec.rb @@ -6,7 +6,7 @@ describe 'As an administrateur I wanna clone a procedure', js: true do let(:administrateur) { create(:administrateur) } before do - create(:procedure, :with_service, :with_instructeur, + create(:procedure, :with_service, :with_instructeur, :with_zone, aasm_state: :publiee, administrateurs: [administrateur], libelle: 'libellé de la procédure', @@ -29,6 +29,11 @@ describe 'As an administrateur I wanna clone a procedure', js: true do find("#service .fr-btn").click click_on "Assigner" + # select zone + find("#zones .fr-btn").click + check Zone.last.current_label + click_on 'Enregistrer' + # then publish find('#publish-procedure-link').click expect(find_field('procedure_path').value).to eq 'libelle-de-la-procedure'