fix spec procedure_cloning

add zone to new procedure
This commit is contained in:
Christophe Robillard 2022-12-20 17:22:19 +01:00
parent cfc2aec334
commit f4977f358b
2 changed files with 15 additions and 1 deletions

View file

@ -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')

View file

@ -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'