2024-04-29 00:17:15 +02:00
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2018-09-24 16:25:34 +02:00
|
|
|
|
RSpec.shared_examples 'the user can edit the submitted demande' do
|
2023-11-06 15:15:51 +01:00
|
|
|
|
scenario js: true do
|
2018-09-24 16:25:34 +02:00
|
|
|
|
visit dossier_path(dossier)
|
|
|
|
|
|
|
|
|
|
expect(page).to have_current_path(dossier_path(dossier))
|
|
|
|
|
click_on 'Demande'
|
|
|
|
|
|
|
|
|
|
expect(page).to have_current_path(demande_dossier_path(dossier))
|
2023-07-10 09:43:19 +02:00
|
|
|
|
click_on 'Modifier le dossier', match: :first
|
2018-09-24 16:25:34 +02:00
|
|
|
|
|
|
|
|
|
expect(page).to have_current_path(modifier_dossier_path(dossier))
|
|
|
|
|
fill_in('Texte obligatoire', with: 'Nouveau texte')
|
|
|
|
|
|
2023-03-21 18:24:39 +01:00
|
|
|
|
click_on 'Déposer les modifications'
|
2023-10-26 16:02:23 +02:00
|
|
|
|
expect(page).to have_current_path(dossier_path(dossier))
|
2022-09-08 11:26:18 +02:00
|
|
|
|
click_on 'Demande'
|
2018-09-24 16:25:34 +02:00
|
|
|
|
expect(page).to have_current_path(demande_dossier_path(dossier))
|
2022-09-08 11:26:18 +02:00
|
|
|
|
|
2018-09-24 16:25:34 +02:00
|
|
|
|
expect(page).to have_content('Nouveau texte')
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
RSpec.shared_examples 'the user can send messages to the instructeur' do
|
|
|
|
|
let!(:commentaire) { create(:commentaire, dossier: dossier, email: 'instructeur@exemple.fr', body: 'Message envoyé à l’usager') }
|
|
|
|
|
let(:message_body) { 'Message envoyé à l’instructeur' }
|
|
|
|
|
|
|
|
|
|
scenario js: true do
|
|
|
|
|
visit dossier_path(dossier)
|
|
|
|
|
|
|
|
|
|
expect(page).to have_current_path(dossier_path(dossier))
|
|
|
|
|
click_on 'Messagerie'
|
|
|
|
|
|
|
|
|
|
expect(page).to have_current_path(messagerie_dossier_path(dossier))
|
|
|
|
|
expect(page).to have_content(commentaire.body)
|
|
|
|
|
|
|
|
|
|
fill_in 'commentaire_body', with: message_body
|
2019-01-07 16:04:59 +01:00
|
|
|
|
click_on 'Envoyer le message'
|
2018-09-24 16:25:34 +02:00
|
|
|
|
|
|
|
|
|
expect(page).to have_current_path(messagerie_dossier_path(dossier))
|
|
|
|
|
expect(page).to have_content('Message envoyé')
|
|
|
|
|
expect(page).to have_content(commentaire.body)
|
|
|
|
|
expect(page).to have_content(message_body)
|
|
|
|
|
end
|
|
|
|
|
end
|