demarches-normaliennes/spec/system/users/dossier_shared_examples.rb
Eric Leroy-Terquem 3f1309011a test gem
2023-08-29 15:11:34 +02:00

44 lines
1.5 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

RSpec.shared_examples 'the user can edit the submitted demande' do
scenario js: true, retry: 3 do
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))
click_on 'Modifier le dossier', match: :first
expect(page).to have_current_path(modifier_dossier_path(dossier))
fill_in('Texte obligatoire', with: 'Nouveau texte')
wait_for_autosave(false)
click_on 'Déposer les modifications'
click_on 'Demande'
expect(page).to have_current_path(demande_dossier_path(dossier))
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é à lusager') }
let(:message_body) { 'Message envoyé à linstructeur' }
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
click_on 'Envoyer le message'
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