demarches-normaliennes/spec/system/users/transfer_dossier_spec.rb

33 lines
1.1 KiB
Ruby
Raw Normal View History

2021-09-08 15:49:04 +02:00
describe 'Transfer dossier:' do
let(:user) { create(:user) }
let(:other_user) { create(:user) }
let(:procedure) { create(:simple_procedure) }
let(:dossier) { create(:dossier, :en_construction, :with_individual, :with_commentaires, user: user, procedure: procedure) }
before do
dossier
login_as user, scope: :user
visit dossiers_path
end
scenario 'the user can transfer dossier to another user' do
within(:css, "tr[data-dossier-id=\"#{dossier.id}\"]") do
click_on 'Actions'
2022-11-24 19:14:25 +01:00
click_on 'Transférer le dossier'
2021-09-08 15:49:04 +02:00
end
expect(page).to have_current_path(transferer_dossier_path(dossier))
2022-11-24 19:14:25 +01:00
expect(page).to have_content("transférer le dossier en construction nº #{dossier.id}")
2021-09-08 15:49:04 +02:00
fill_in 'Email du compte destinataire', with: other_user.email
click_on 'Envoyer la demande de transfert'
logout
login_as other_user, scope: :user
visit dossiers_path
2023-03-02 16:55:37 +01:00
expect(page).to have_content("Demande de transfert pour le dossier Nº #{dossier.id} envoyé par #{user.email}")
2021-09-08 15:49:04 +02:00
click_on 'Accepter'
expect(page).to have_current_path(dossiers_path)
end
end