2021-10-26 11:44:53 +02:00
|
|
|
require 'system/users/dossier_shared_examples.rb'
|
2018-09-24 16:25:34 +02:00
|
|
|
|
2018-08-07 16:32:11 +02:00
|
|
|
describe 'Dossier details:' do
|
|
|
|
let(:user) { create(:user) }
|
2018-09-24 15:54:46 +02:00
|
|
|
let(:procedure) { create(:simple_procedure) }
|
2020-01-07 17:47:22 +01:00
|
|
|
let(:dossier) { create(:dossier, :en_construction, :with_individual, :with_commentaires, user: user, procedure: procedure) }
|
2018-08-07 16:32:11 +02:00
|
|
|
|
|
|
|
before do
|
2018-09-25 11:24:41 +02:00
|
|
|
visit_dossier dossier
|
2018-08-07 16:32:11 +02:00
|
|
|
end
|
|
|
|
|
2018-08-10 16:17:19 +02:00
|
|
|
scenario 'the user can see the summary of the dossier status' do
|
2018-08-07 16:32:11 +02:00
|
|
|
expect(page).to have_current_path(dossier_path(dossier))
|
|
|
|
expect(page).to have_content(dossier.id)
|
2018-08-10 16:17:19 +02:00
|
|
|
expect(page).to have_selector('.status-explanation')
|
2018-09-11 18:40:10 +02:00
|
|
|
expect(page).to have_text(dossier.commentaires.last.body)
|
2018-08-07 16:32:11 +02:00
|
|
|
end
|
|
|
|
|
2022-05-18 14:27:26 +02:00
|
|
|
scenario 'the user can download a deposit receipt' do
|
|
|
|
visit dossier_path(dossier)
|
|
|
|
expect(page).to have_link("Obtenir une attestation de dépôt de dossier", href: %r{dossiers/#{dossier.id}/papertrail.pdf})
|
2022-05-04 10:48:57 +02:00
|
|
|
end
|
|
|
|
|
2018-09-18 17:45:24 +02:00
|
|
|
describe "the user can see the mean time they are expected to wait" do
|
2021-12-06 15:49:17 +01:00
|
|
|
let(:other_dossier) { create(:dossier, :accepte, :with_individual, procedure: procedure, depose_at: 10.days.ago, en_instruction_at: 9.days.ago, processed_at: Time.zone.now) }
|
2019-04-10 16:29:03 +02:00
|
|
|
|
2020-07-15 11:08:15 +02:00
|
|
|
context "when the dossier is in construction" do
|
2019-04-10 16:29:03 +02:00
|
|
|
it "displays the estimated wait duration" do
|
|
|
|
other_dossier
|
2018-09-25 11:24:41 +02:00
|
|
|
visit dossier_path(dossier)
|
2019-04-10 16:29:03 +02:00
|
|
|
expect(page).to have_text("Habituellement, les dossiers de cette démarche sont traités dans un délai de 10 jours.")
|
2018-09-18 17:47:41 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-07-15 11:08:15 +02:00
|
|
|
context "when the dossier is in instruction" do
|
2020-01-07 17:47:22 +01:00
|
|
|
let(:dossier) { create(:dossier, :en_instruction, :with_individual, :with_commentaires, user: user, procedure: procedure) }
|
2018-09-18 17:45:24 +02:00
|
|
|
|
2019-04-10 16:29:03 +02:00
|
|
|
it "displays the estimated wait duration" do
|
|
|
|
other_dossier
|
2018-09-25 11:24:41 +02:00
|
|
|
visit dossier_path(dossier)
|
2019-04-10 16:29:03 +02:00
|
|
|
expect(page).to have_text("Habituellement, les dossiers de cette démarche sont traités dans un délai de 10 jours.")
|
2018-09-18 17:45:24 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-10-02 14:50:53 +02:00
|
|
|
scenario 'the user is redirected from old URLs' do
|
|
|
|
visit "/users/dossiers/#{dossier.id}/recapitulatif"
|
|
|
|
expect(page).to have_current_path(dossier_path(dossier))
|
|
|
|
end
|
|
|
|
|
2023-11-06 15:15:51 +01:00
|
|
|
context 'with js', js: true do
|
2022-09-08 11:26:18 +02:00
|
|
|
it_behaves_like 'the user can edit the submitted demande'
|
|
|
|
it_behaves_like 'the user can send messages to the instructeur'
|
|
|
|
end
|
2018-09-05 13:56:12 +02:00
|
|
|
|
2018-08-07 16:32:11 +02:00
|
|
|
private
|
|
|
|
|
|
|
|
def visit_dossier(dossier)
|
|
|
|
visit dossier_path(dossier)
|
|
|
|
|
|
|
|
expect(page).to have_current_path(new_user_session_path)
|
|
|
|
fill_in 'user_email', with: user.email
|
|
|
|
fill_in 'user_password', with: user.password
|
|
|
|
click_on 'Se connecter'
|
|
|
|
|
|
|
|
expect(page).to have_current_path(dossier_path(dossier))
|
|
|
|
end
|
|
|
|
end
|