feat(instructeur): nest all instruction routes under statut params for back purpose
This commit is contained in:
parent
b426e51d87
commit
c260c43dac
30 changed files with 195 additions and 141 deletions
|
@ -13,4 +13,8 @@ class Dossiers::BatchAlertComponent < ApplicationComponent
|
||||||
@batch.seen_at = Time.zone.now
|
@batch.seen_at = Time.zone.now
|
||||||
@batch.save
|
@batch.save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def procedure_path
|
||||||
|
instructeur_procedure_path(@procedure, statut: params[:statut])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
%p= t(".#{batch.operation}.in_progress.text_success", count: @batch.total_count, success_count: @batch.success_count)
|
%p= t(".#{batch.operation}.in_progress.text_success", count: @batch.total_count, success_count: @batch.success_count)
|
||||||
|
|
||||||
%p
|
%p
|
||||||
= link_to t('.link_text'), instructeur_procedure_path(@procedure, statut: params["statut"]), data: { action: 'turbo-poll#refresh' }
|
= link_to t('.link_text'), procedure_path, data: { action: 'turbo-poll#refresh' }
|
||||||
= t('.after_link_text')
|
= t('.after_link_text')
|
||||||
|
|
||||||
%p.fr-mt-2w
|
%p.fr-mt-2w
|
||||||
|
|
|
@ -80,7 +80,7 @@ class Dossiers::MessageComponent < ApplicationComponent
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_url
|
def delete_url
|
||||||
groupe_gestionnaire ? gestionnaire_groupe_gestionnaire_commentaire_path(groupe_gestionnaire, commentaire) : instructeur_commentaire_path(commentaire.dossier.procedure, commentaire.dossier, commentaire)
|
groupe_gestionnaire ? gestionnaire_groupe_gestionnaire_commentaire_path(groupe_gestionnaire, commentaire, statut: params[:statut]) : instructeur_commentaire_path(commentaire.dossier.procedure, commentaire.dossier, commentaire, statut: params[:statut])
|
||||||
end
|
end
|
||||||
|
|
||||||
def highlight?
|
def highlight?
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
- if dossier.may_repasser_en_construction?
|
- if dossier.may_repasser_en_construction?
|
||||||
= menu.with_item do
|
= menu.with_item do
|
||||||
= link_to(repasser_en_construction_instructeur_dossier_path(dossier.procedure.id, dossier.id), method: :post, role: 'menuitem') do
|
= link_to(repasser_en_construction_instructeur_dossier_path(dossier.procedure.id, dossier.id, statut: params[:statut]), method: :post, role: 'menuitem') do
|
||||||
%span.fr-icon.fr-icon-draft-line.fr-text-default--info.fr-mt-1v{ "aria-hidden": "true" }
|
%span.fr-icon.fr-icon-draft-line.fr-text-default--info.fr-mt-1v{ "aria-hidden": "true" }
|
||||||
.dropdown-description
|
.dropdown-description
|
||||||
%h4= t('.revert_en_construction')
|
%h4= t('.revert_en_construction')
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
- menu.with_item(class: "inactive form-inside fr-pt-1v") do
|
- menu.with_item(class: "inactive form-inside fr-pt-1v") do
|
||||||
= render partial: 'instructeurs/dossiers/instruction_button_motivation', locals: { dossier:,
|
= render partial: 'instructeurs/dossiers/instruction_button_motivation', locals: { dossier:,
|
||||||
visible: true,
|
visible: true,
|
||||||
form_path: pending_correction_instructeur_dossier_path(dossier.procedure, dossier),
|
form_path: pending_correction_instructeur_dossier_path(dossier.procedure, dossier, statut: params[:statut]),
|
||||||
placeholder: 'Expliquez au demandeur quelle(s) correction(s) sont attendues',
|
placeholder: 'Expliquez au demandeur quelle(s) correction(s) sont attendues',
|
||||||
popup_class: 'pending_correction',
|
popup_class: 'pending_correction',
|
||||||
button_justificatif_label: "Ajouter une pièce jointe (facultatif)",
|
button_justificatif_label: "Ajouter une pièce jointe (facultatif)",
|
||||||
|
|
|
@ -22,7 +22,7 @@ module Instructeurs
|
||||||
else
|
else
|
||||||
flash[:notice] = "Cette archive a déjà été générée."
|
flash[:notice] = "Cette archive a déjà été générée."
|
||||||
end
|
end
|
||||||
redirect_to instructeur_archives_path(@procedure)
|
redirect_to list_instructeur_archives_path(@procedure)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -12,7 +12,7 @@ module Instructeurs
|
||||||
avis = Avis.find(params[:id])
|
avis = Avis.find(params[:id])
|
||||||
if avis.revoke_by!(current_instructeur)
|
if avis.revoke_by!(current_instructeur)
|
||||||
flash.notice = "#{avis.expert.email} ne peut plus donner son avis sur ce dossier."
|
flash.notice = "#{avis.expert.email} ne peut plus donner son avis sur ce dossier."
|
||||||
redirect_back(fallback_location: avis_instructeur_dossier_path(avis.procedure, avis.dossier))
|
redirect_back(fallback_location: avis_instructeur_dossier_path(avis.procedure, params[:statut], avis.dossier))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ module Instructeurs
|
||||||
AvisMailer.avis_invitation(avis).deliver_later
|
AvisMailer.avis_invitation(avis).deliver_later
|
||||||
end
|
end
|
||||||
flash.notice = "Un mail de relance a été envoyé à #{avis.expert.email}"
|
flash.notice = "Un mail de relance a été envoyé à #{avis.expert.email}"
|
||||||
redirect_back(fallback_location: avis_instructeur_dossier_path(avis.procedure, avis.dossier))
|
redirect_back(fallback_location: avis_instructeur_dossier_path(avis.procedure, params[:statut], avis.dossier))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -278,7 +278,7 @@ module Instructeurs
|
||||||
@commentaire.dossier.touch(:last_commentaire_updated_at)
|
@commentaire.dossier.touch(:last_commentaire_updated_at)
|
||||||
current_instructeur.follow(dossier)
|
current_instructeur.follow(dossier)
|
||||||
flash.notice = "Message envoyé"
|
flash.notice = "Message envoyé"
|
||||||
redirect_to messagerie_instructeur_dossier_path(procedure, dossier)
|
redirect_to messagerie_instructeur_dossier_path(procedure, dossier, statut: statut)
|
||||||
else
|
else
|
||||||
@commentaire.piece_jointe.purge.reload
|
@commentaire.piece_jointe.purge.reload
|
||||||
flash.alert = @commentaire.errors.full_messages
|
flash.alert = @commentaire.errors.full_messages
|
||||||
|
@ -290,7 +290,7 @@ module Instructeurs
|
||||||
@avis = create_avis_from_params(dossier, current_instructeur)
|
@avis = create_avis_from_params(dossier, current_instructeur)
|
||||||
|
|
||||||
if @avis.nil?
|
if @avis.nil?
|
||||||
redirect_to avis_instructeur_dossier_path(procedure, dossier)
|
redirect_to avis_instructeur_dossier_path(procedure, dossier, statut: statut)
|
||||||
else
|
else
|
||||||
@avis_seen_at = current_instructeur.follows.find_by(dossier: dossier)&.avis_seen_at
|
@avis_seen_at = current_instructeur.follows.find_by(dossier: dossier)&.avis_seen_at
|
||||||
render :avis
|
render :avis
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
= render(Dsfr::SidemenuComponent.new) do |component|
|
= render(Dsfr::SidemenuComponent.new) do |component|
|
||||||
- component.with_links([{ name: t('helpers.sidemenu.see_avis'), url: avis_instructeur_dossier_path(@dossier.procedure, @dossier) }, { name: t('helpers.sidemenu.ask_avis'), url: avis_new_instructeur_dossier_path(@dossier.procedure, @dossier) }])
|
- component.with_links([{ name: t('helpers.sidemenu.see_avis'), url: avis_instructeur_dossier_path(procedure_id: @dossier.procedure.id, statut: params[:statut], dossier_id: @dossier.id) }, { name: t('helpers.sidemenu.ask_avis'), url: avis_new_instructeur_dossier_path(@dossier.procedure, params[:statut], @dossier) }])
|
||||||
|
|
|
@ -4,30 +4,30 @@
|
||||||
- notifications_summary = current_instructeur.notifications_for_dossier(dossier)
|
- notifications_summary = current_instructeur.notifications_for_dossier(dossier)
|
||||||
|
|
||||||
= dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.request'),
|
= dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.request'),
|
||||||
instructeur_dossier_path(dossier.procedure, dossier),
|
instructeur_dossier_path(dossier.procedure, params[:statut], dossier),
|
||||||
notification: notifications_summary[:demande])
|
notification: notifications_summary[:demande])
|
||||||
|
|
||||||
- if gallery_attachments.present?
|
- if gallery_attachments.present?
|
||||||
= dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.attachments'),
|
= dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.attachments'),
|
||||||
pieces_jointes_instructeur_dossier_path(dossier.procedure, dossier),
|
pieces_jointes_instructeur_dossier_path(dossier.procedure, dossier, statut: params[:statut]),
|
||||||
notification: notifications_summary[:pieces_jointes])
|
notification: notifications_summary[:pieces_jointes])
|
||||||
|
|
||||||
= dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.private_annotations'),
|
= dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.private_annotations'),
|
||||||
annotations_privees_instructeur_dossier_path(dossier.procedure, dossier),
|
annotations_privees_instructeur_dossier_path(dossier.procedure, dossier, statut: params[:statut]),
|
||||||
notification: notifications_summary[:annotations_privees])
|
notification: notifications_summary[:annotations_privees])
|
||||||
|
|
||||||
= dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.external_opinion'),
|
= dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.external_opinion'),
|
||||||
[avis_instructeur_dossier_path(dossier.procedure, dossier),
|
[avis_instructeur_dossier_path(dossier.procedure, dossier, statut: params[:statut]),
|
||||||
avis_new_instructeur_dossier_path(dossier.procedure, dossier)],
|
avis_new_instructeur_dossier_path(dossier.procedure, dossier, statut: params[:statut])],
|
||||||
notification: notifications_summary[:avis])
|
notification: notifications_summary[:avis])
|
||||||
|
|
||||||
= dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.messaging'),
|
= dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.messaging'),
|
||||||
messagerie_instructeur_dossier_path(dossier.procedure, dossier),
|
messagerie_instructeur_dossier_path(dossier.procedure, dossier, statut: params[:statut]),
|
||||||
notification: notifications_summary[:messagerie])
|
notification: notifications_summary[:messagerie])
|
||||||
|
|
||||||
= dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.involved_persons'),
|
= dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.involved_persons'),
|
||||||
personnes_impliquees_instructeur_dossier_path(dossier.procedure, dossier))
|
personnes_impliquees_instructeur_dossier_path(dossier.procedure, dossier, statut: params[:statut]))
|
||||||
|
|
||||||
- if dossier.procedure.routing_enabled?
|
- if dossier.procedure.routing_enabled?
|
||||||
= dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.reaffectation'),
|
= dynamic_tab_item(t('views.instructeurs.dossiers.tab_steps.reaffectation'),
|
||||||
reaffectation_instructeur_dossier_path(dossier.procedure, dossier))
|
reaffectation_instructeur_dossier_path(dossier.procedure, dossier, statut: params[:statut]))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.motivation{ class: class_names(popup_class => true, hidden: !defined?(visible) || !visible, "fr-pb-2w fr-px-2w": true) }
|
.motivation{ class: class_names(popup_class => true, hidden: !defined?(visible) || !visible, "fr-pb-2w fr-px-2w": true) }
|
||||||
= form_tag(defined?(form_path) ? form_path : terminer_instructeur_dossier_path(dossier.procedure, dossier), data: { turbo: true, turbo_confirm: confirm }, method: :post, multipart: true) do
|
= form_tag(defined?(form_path) ? form_path : terminer_instructeur_dossier_path(dossier.procedure, dossier, statut: params[:statut]), data: { turbo: true, turbo_confirm: confirm }, method: :post, multipart: true) do
|
||||||
- if title == 'Accepter'
|
- if title == 'Accepter'
|
||||||
= text_area :dossier, :motivation, class: 'fr-input', placeholder: placeholder, required: false
|
= text_area :dossier, :motivation, class: 'fr-input', placeholder: placeholder, required: false
|
||||||
- if dossier.attestation_template&.activated?
|
- if dossier.attestation_template&.activated?
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
Uniquement cet onglet
|
Uniquement cet onglet
|
||||||
|
|
||||||
- menu.with_item do
|
- menu.with_item do
|
||||||
= link_to instructeur_dossier_path(dossier.procedure, dossier, format: :pdf), target: "_blank", rel: "noopener", class: "menu-item menu-link", role: 'menuitem' do
|
= link_to instructeur_dossier_path(dossier.procedure, dossier, statut: params[:statut], format: :pdf), target: "_blank", rel: "noopener", class: "menu-item menu-link", role: 'menuitem' do
|
||||||
Export PDF
|
Export PDF
|
||||||
|
|
||||||
- if dossier.geo_data?
|
- if dossier.geo_data?
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
.fr-col
|
.fr-col
|
||||||
- if !@dossier.termine?
|
- if !@dossier.termine?
|
||||||
- if @dossier.procedure.allow_expert_review
|
- if @dossier.procedure.allow_expert_review
|
||||||
= render partial: "shared/avis/form", locals: { url: avis_instructeur_dossier_path(@dossier.procedure, @dossier), linked_dossiers: @dossier.linked_dossiers_for(current_instructeur), must_be_confidentiel: false, avis: @avis }
|
= render partial: "shared/avis/form", locals: { url: avis_instructeur_dossier_path(@dossier.procedure, params[:statut], @dossier), linked_dossiers: @dossier.linked_dossiers_for(current_instructeur), must_be_confidentiel: false, avis: @avis }
|
||||||
- else
|
- else
|
||||||
%h2.empty-text
|
%h2.empty-text
|
||||||
= t('helpers.information_text.unauthorized_avis_text')
|
= t('helpers.information_text.unauthorized_avis_text')
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
= render partial: "header", locals: { dossier: @dossier, gallery_attachments: @gallery_attachments }
|
= render partial: "header", locals: { dossier: @dossier, gallery_attachments: @gallery_attachments }
|
||||||
|
|
||||||
= render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, connected_user: current_instructeur, messagerie_seen_at: @messagerie_seen_at , new_commentaire: @commentaire, form_url: commentaire_instructeur_dossier_path(@dossier.procedure, @dossier) }
|
= render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, connected_user: current_instructeur, messagerie_seen_at: @messagerie_seen_at , new_commentaire: @commentaire, form_url: commentaire_instructeur_dossier_path(@dossier.procedure, @dossier, statut: params[:statut]) }
|
||||||
|
|
|
@ -25,23 +25,23 @@
|
||||||
= ""
|
= ""
|
||||||
|
|
||||||
- else
|
- else
|
||||||
= button_to repasser_en_instruction_instructeur_dossier_path(procedure_id, dossier_id), method: :post, class: 'fr-btn fr-btn--secondary fr-icon-edit-line', form: { data: { turbo: turbo ? 'true' : 'false' } } do
|
= button_to repasser_en_instruction_instructeur_dossier_path(procedure_id, dossier_id, statut: params[:statut]), method: :post, class: 'fr-btn fr-btn--secondary fr-icon-edit-line', form: { data: { turbo: turbo ? 'true' : 'false' } } do
|
||||||
Repasser en instruction
|
Repasser en instruction
|
||||||
|
|
||||||
= button_to archive_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: 'fr-btn fr-icon-folder-2-line' do
|
= button_to archive_instructeur_dossier_path(procedure_id, dossier_id, statut: params[:statut]), method: :patch, class: 'fr-btn fr-icon-folder-2-line' do
|
||||||
Archiver le dossier
|
Archiver le dossier
|
||||||
|
|
||||||
= button_to instructeur_dossier_path(procedure_id, dossier_id), method: :delete, class: 'fr-btn fr-btn--secondary fr-icon-delete-line icon-only danger', title: t('views.instructeurs.dossiers.delete_dossier') do
|
= button_to instructeur_dossier_path(procedure_id, dossier_id, statut: params[:statut]), method: :delete, class: 'fr-btn fr-btn--secondary fr-icon-delete-line icon-only danger', title: t('views.instructeurs.dossiers.delete_dossier') do
|
||||||
= ""
|
= ""
|
||||||
|
|
||||||
- elsif Dossier::EN_CONSTRUCTION_OU_INSTRUCTION.include?(state)
|
- elsif Dossier::EN_CONSTRUCTION_OU_INSTRUCTION.include?(state)
|
||||||
- if dossier_is_followed
|
- if dossier_is_followed
|
||||||
%li
|
%li
|
||||||
= button_to unfollow_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: 'fr-btn fr-btn--secondary fr-icon-star-fill' do
|
= button_to unfollow_instructeur_dossier_path(procedure_id, statut: params[:statut], dossier_id:), method: :patch, class: 'fr-btn fr-btn--secondary fr-icon-star-fill' do
|
||||||
= t('views.instructeurs.dossiers.stop_follow')
|
= t('views.instructeurs.dossiers.stop_follow')
|
||||||
- else
|
- else
|
||||||
%li
|
%li
|
||||||
= button_to follow_instructeur_dossier_path(procedure_id, dossier_id), method: :patch, class: 'fr-btn fr-btn--secondary fr-icon-star-line' do
|
= button_to follow_instructeur_dossier_path(procedure_id, statut: params[:statut], dossier_id:), method: :patch, class: 'fr-btn fr-btn--secondary fr-icon-star-line' do
|
||||||
= t('views.instructeurs.dossiers.follow_file')
|
= t('views.instructeurs.dossiers.follow_file')
|
||||||
|
|
||||||
- if with_menu
|
- if with_menu
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
|
|
||||||
- if Dossier.states[:en_construction] == state
|
- if Dossier.states[:en_construction] == state
|
||||||
%li{ 'data-turbo': turbo ? 'true' : 'false' }
|
%li{ 'data-turbo': turbo ? 'true' : 'false' }
|
||||||
= button_to passer_en_instruction_instructeur_dossier_path(procedure_id, dossier_id), method: :post, class: 'fr-btn fr-icon-edit-line',
|
= button_to passer_en_instruction_instructeur_dossier_path(procedure_id, statut: params[:statut], dossier_id:), method: :post, class: 'fr-btn fr-icon-edit-line',
|
||||||
disabled: has_blocking_pending_correction, "aria-describedby" => has_blocking_pending_correction ? "tooltip-passer-en-instruction" : nil do
|
disabled: has_blocking_pending_correction, "aria-describedby" => has_blocking_pending_correction ? "tooltip-passer-en-instruction" : nil do
|
||||||
= t('views.instructeurs.dossiers.passer_en_instruction')
|
= t('views.instructeurs.dossiers.passer_en_instruction')
|
||||||
|
|
||||||
|
@ -60,5 +60,5 @@
|
||||||
|
|
||||||
- elsif Dossier.states[:en_instruction] == state && !with_menu && !sva_svr
|
- elsif Dossier.states[:en_instruction] == state && !with_menu && !sva_svr
|
||||||
%li{ 'data-turbo': turbo ? 'true' : 'false' }
|
%li{ 'data-turbo': turbo ? 'true' : 'false' }
|
||||||
= button_to repasser_en_construction_instructeur_dossier_path(procedure_id, dossier_id), method: :post, class: 'fr-btn fr-btn--secondary fr-icon-draft-line' do
|
= button_to repasser_en_construction_instructeur_dossier_path(procedure_id, statut: params[:statut], dossier_id:), method: :post, class: 'fr-btn fr-btn--secondary fr-icon-draft-line' do
|
||||||
= t('views.instructeurs.dossiers.repasser_en_construction')
|
= t('views.instructeurs.dossiers.repasser_en_construction')
|
||||||
|
|
|
@ -111,7 +111,7 @@
|
||||||
|
|
||||||
- @projected_dossiers.each do |p|
|
- @projected_dossiers.each do |p|
|
||||||
- dossier = p.dossier
|
- dossier = p.dossier
|
||||||
- path = instructeur_dossier_path(@procedure, dossier.id)
|
- path = instructeur_dossier_path(@procedure, dossier.id, statut: params[:statut])
|
||||||
%tr{ class: class_names("file-hidden-by-user" => dossier.hidden_by_user_at.present?), id: "table-dossiers-row-#{dossier.id}", "aria-selected" => "false", "data-row-key" => dossier.id }
|
%tr{ class: class_names("file-hidden-by-user" => dossier.hidden_by_user_at.present?), id: "table-dossiers-row-#{dossier.id}", "aria-selected" => "false", "data-row-key" => dossier.id }
|
||||||
- if batch_operation_component.render?
|
- if batch_operation_component.render?
|
||||||
%th.fr-cell--fixed{ scope: 'row' }
|
%th.fr-cell--fixed{ scope: 'row' }
|
||||||
|
|
|
@ -42,10 +42,10 @@
|
||||||
= t('relance_effectuee_le', scope: 'views.shared.avis', date: l(avis.reminded_at, format: '%d/%m/%y à %H:%M'))
|
= t('relance_effectuee_le', scope: 'views.shared.avis', date: l(avis.reminded_at, format: '%d/%m/%y à %H:%M'))
|
||||||
- if expert_or_instructeur.is_a?(Instructeur)
|
- if expert_or_instructeur.is_a?(Instructeur)
|
||||||
- if avis.answer.blank?
|
- if avis.answer.blank?
|
||||||
= link_to(t('remind', scope: 'helpers.label'), remind_instructeur_avis_path(avis.procedure, avis), class:'fr-btn fr-btn--sm fr-btn--tertiary-no-outline', data: { confirm: t('remind', scope: 'helpers.confirmation', email: avis.expert.email) })
|
= link_to(t('remind', scope: 'helpers.label'), remind_instructeur_avis_path(avis.procedure, params[:statut], avis), class:'fr-btn fr-btn--sm fr-btn--tertiary-no-outline', data: { confirm: t('remind', scope: 'helpers.confirmation', email: avis.expert.email) })
|
||||||
|
|
||||||
- if avis.revokable_by?(expert_or_instructeur)
|
- if avis.revokable_by?(expert_or_instructeur)
|
||||||
= link_to(t('revoke', scope: 'helpers.label'), revoquer_instructeur_avis_path(avis.procedure, avis), class:'fr-btn fr-btn--sm fr-btn--tertiary-no-outline', data: { confirm: t('revoke', scope: 'helpers.confirmation', email: avis.expert.email) }, method: :patch)
|
= link_to(t('revoke', scope: 'helpers.label'), revoquer_instructeur_avis_path(avis.procedure, params[:statut], avis), class:'fr-btn fr-btn--sm fr-btn--tertiary-no-outline', data: { confirm: t('revoke', scope: 'helpers.confirmation', email: avis.expert.email) }, method: :patch)
|
||||||
|
|
||||||
.border-left
|
.border-left
|
||||||
- if avis.introduction_file.attached?
|
- if avis.introduction_file.attached?
|
||||||
|
|
110
config/routes.rb
110
config/routes.rb
|
@ -468,9 +468,69 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :procedures, only: [:index, :show], param: :procedure_id do
|
resources :procedures, only: [:index], param: :procedure_id do
|
||||||
member do
|
member do
|
||||||
resources :archives, only: [:index, :create]
|
#
|
||||||
|
# nested navigation, all those route are hit during an instructeur instruction navigation context
|
||||||
|
# must keep track of last view statut page
|
||||||
|
#
|
||||||
|
constraints statut: /a-suivre|suivis|traites|tous|supprimes|expirant|archives/ do
|
||||||
|
get :show, path: "(:statut)", defaults: { statut: 'a-suivre' } # optional because some url may still live on with /procedure/:id
|
||||||
|
|
||||||
|
resources :dossiers, only: [:show, :destroy], param: :dossier_id, path: "(:statut)/dossiers", defaults: { statut: 'a-suivre' } do
|
||||||
|
member do
|
||||||
|
resources :commentaires, only: [:destroy]
|
||||||
|
post 'repousser-expiration' => 'dossiers#extend_conservation'
|
||||||
|
post 'repousser-expiration-and-restore' => 'dossiers#extend_conservation_and_restore'
|
||||||
|
post 'dossier_labels' => 'dossiers#dossier_labels'
|
||||||
|
get 'messagerie'
|
||||||
|
get 'annotations-privees' => 'dossiers#annotations_privees'
|
||||||
|
get 'avis'
|
||||||
|
get 'avis_new'
|
||||||
|
get 'personnes-impliquees' => 'dossiers#personnes_impliquees'
|
||||||
|
patch 'follow'
|
||||||
|
patch 'unfollow'
|
||||||
|
patch 'archive'
|
||||||
|
patch 'unarchive'
|
||||||
|
patch 'restore'
|
||||||
|
post 'commentaire' => 'dossiers#create_commentaire'
|
||||||
|
post 'passer-en-instruction' => 'dossiers#passer_en_instruction'
|
||||||
|
post 'repasser-en-construction' => 'dossiers#repasser_en_construction'
|
||||||
|
post 'repasser-en-instruction' => 'dossiers#repasser_en_instruction'
|
||||||
|
post 'terminer'
|
||||||
|
post 'pending_correction'
|
||||||
|
post 'send-to-instructeurs' => 'dossiers#send_to_instructeurs'
|
||||||
|
post 'avis' => 'dossiers#create_avis'
|
||||||
|
get 'reaffectation'
|
||||||
|
get 'pieces_jointes'
|
||||||
|
post 'reaffecter'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
resources :avis, only: [], path: "(:statut)/dossiers", defaults: { statut: 'a-suivre' } do
|
||||||
|
member do
|
||||||
|
patch 'revoquer'
|
||||||
|
get 'remind'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
resources :batch_operations, only: [:create], path: "(:statut)/dossiers", defaults: { statut: 'a-suivre' }
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# not nested navigation
|
||||||
|
#
|
||||||
|
resources :dossiers, only: [], param: :dossier_id do
|
||||||
|
member do
|
||||||
|
get 'telecharger_pjs' => 'dossiers#telecharger_pjs'
|
||||||
|
get 'print' => 'dossiers#print'
|
||||||
|
patch 'annotations' => 'dossiers#update_annotations'
|
||||||
|
get 'annotations/:stable_id', to: 'dossiers#annotation', as: :annotation
|
||||||
|
get 'geo_data'
|
||||||
|
get 'apercu_attestation'
|
||||||
|
get 'bilans_bdf'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
resources :groupes, only: [:index, :show], controller: 'groupe_instructeurs' do
|
resources :groupes, only: [:index, :show], controller: 'groupe_instructeurs' do
|
||||||
resource :contact_information
|
resource :contact_information
|
||||||
|
@ -482,13 +542,6 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :avis, only: [] do
|
|
||||||
member do
|
|
||||||
patch 'revoquer'
|
|
||||||
get 'remind'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
get 'apercu'
|
get 'apercu'
|
||||||
get 'download_export'
|
get 'download_export'
|
||||||
post 'download_export'
|
post 'download_export'
|
||||||
|
@ -502,45 +555,6 @@ Rails.application.routes.draw do
|
||||||
get 'deleted_dossiers'
|
get 'deleted_dossiers'
|
||||||
get 'email_usagers'
|
get 'email_usagers'
|
||||||
post 'create_multiple_commentaire'
|
post 'create_multiple_commentaire'
|
||||||
|
|
||||||
resources :dossiers, only: [:show, :destroy], param: :dossier_id do
|
|
||||||
member do
|
|
||||||
resources :commentaires, only: [:destroy]
|
|
||||||
post 'repousser-expiration' => 'dossiers#extend_conservation'
|
|
||||||
post 'repousser-expiration-and-restore' => 'dossiers#extend_conservation_and_restore'
|
|
||||||
post 'dossier_labels' => 'dossiers#dossier_labels'
|
|
||||||
get 'geo_data'
|
|
||||||
get 'apercu_attestation'
|
|
||||||
get 'bilans_bdf'
|
|
||||||
get 'messagerie'
|
|
||||||
get 'annotations-privees' => 'dossiers#annotations_privees'
|
|
||||||
get 'avis'
|
|
||||||
get 'avis_new'
|
|
||||||
get 'personnes-impliquees' => 'dossiers#personnes_impliquees'
|
|
||||||
get 'annotations/:stable_id', to: 'dossiers#annotation', as: :annotation
|
|
||||||
patch 'follow'
|
|
||||||
patch 'unfollow'
|
|
||||||
patch 'archive'
|
|
||||||
patch 'unarchive'
|
|
||||||
patch 'restore'
|
|
||||||
patch 'annotations' => 'dossiers#update_annotations'
|
|
||||||
post 'commentaire' => 'dossiers#create_commentaire'
|
|
||||||
post 'passer-en-instruction' => 'dossiers#passer_en_instruction'
|
|
||||||
post 'repasser-en-construction' => 'dossiers#repasser_en_construction'
|
|
||||||
post 'repasser-en-instruction' => 'dossiers#repasser_en_instruction'
|
|
||||||
post 'terminer'
|
|
||||||
post 'pending_correction'
|
|
||||||
post 'send-to-instructeurs' => 'dossiers#send_to_instructeurs'
|
|
||||||
post 'avis' => 'dossiers#create_avis'
|
|
||||||
get 'print' => 'dossiers#print'
|
|
||||||
get 'telecharger_pjs' => 'dossiers#telecharger_pjs'
|
|
||||||
get 'reaffectation'
|
|
||||||
get 'pieces_jointes'
|
|
||||||
post 'reaffecter'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
resources :batch_operations, only: [:create]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,15 @@ RSpec.describe Dossiers::BatchAlertComponent, type: :component do
|
||||||
let(:procedure) { create(:procedure) }
|
let(:procedure) { create(:procedure) }
|
||||||
|
|
||||||
subject { render_inline(component).to_html }
|
subject { render_inline(component).to_html }
|
||||||
|
let(:component) do
|
||||||
|
described_class.new(
|
||||||
|
batch: batch_operation,
|
||||||
|
procedure:
|
||||||
|
)
|
||||||
|
end
|
||||||
|
before do
|
||||||
|
allow(component).to receive(:procedure_path).and_return(Rails.application.routes.url_helpers.instructeur_procedure_path(procedure, statut: 'a-suivre'))
|
||||||
|
end
|
||||||
|
|
||||||
describe 'archiver' do
|
describe 'archiver' do
|
||||||
let(:component) do
|
let(:component) do
|
||||||
|
@ -54,7 +63,7 @@ RSpec.describe Dossiers::BatchAlertComponent, type: :component do
|
||||||
it { expect(batch_operation.seen_at).to eq(nil) }
|
it { expect(batch_operation.seen_at).to eq(nil) }
|
||||||
|
|
||||||
it 'on next render "seen_at" is set to avoid rendering alert' do
|
it 'on next render "seen_at" is set to avoid rendering alert' do
|
||||||
render_inline(component).to_html
|
render_inline(described_class.new(batch: batch_operation, procedure:)).to_html
|
||||||
expect(batch_operation.seen_at).not_to eq(nil)
|
expect(batch_operation.seen_at).not_to eq(nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -108,7 +117,7 @@ RSpec.describe Dossiers::BatchAlertComponent, type: :component do
|
||||||
it { expect(batch_operation.seen_at).to eq(nil) }
|
it { expect(batch_operation.seen_at).to eq(nil) }
|
||||||
|
|
||||||
it 'on next render "seen_at" is set to avoid rendering alert' do
|
it 'on next render "seen_at" is set to avoid rendering alert' do
|
||||||
render_inline(component).to_html
|
render_inline(described_class.new(batch: batch_operation, procedure:)).to_html
|
||||||
expect(batch_operation.seen_at).not_to eq(nil)
|
expect(batch_operation.seen_at).not_to eq(nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -162,7 +171,7 @@ RSpec.describe Dossiers::BatchAlertComponent, type: :component do
|
||||||
it { expect(batch_operation.seen_at).to eq(nil) }
|
it { expect(batch_operation.seen_at).to eq(nil) }
|
||||||
|
|
||||||
it 'on next render "seen_at" is set to avoid rendering alert' do
|
it 'on next render "seen_at" is set to avoid rendering alert' do
|
||||||
render_inline(component).to_html
|
render_inline(described_class.new(batch: batch_operation, procedure:)).to_html
|
||||||
expect(batch_operation.seen_at).not_to eq(nil)
|
expect(batch_operation.seen_at).not_to eq(nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -216,7 +225,7 @@ RSpec.describe Dossiers::BatchAlertComponent, type: :component do
|
||||||
it { expect(batch_operation.seen_at).to eq(nil) }
|
it { expect(batch_operation.seen_at).to eq(nil) }
|
||||||
|
|
||||||
it 'on next render "seen_at" is set to avoid rendering alert' do
|
it 'on next render "seen_at" is set to avoid rendering alert' do
|
||||||
render_inline(component).to_html
|
render_inline(described_class.new(batch: batch_operation, procedure:)).to_html
|
||||||
expect(batch_operation.seen_at).not_to eq(nil)
|
expect(batch_operation.seen_at).not_to eq(nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -270,7 +279,7 @@ RSpec.describe Dossiers::BatchAlertComponent, type: :component do
|
||||||
it { expect(batch_operation.seen_at).to eq(nil) }
|
it { expect(batch_operation.seen_at).to eq(nil) }
|
||||||
|
|
||||||
it 'on next render "seen_at" is set to avoid rendering alert' do
|
it 'on next render "seen_at" is set to avoid rendering alert' do
|
||||||
render_inline(component).to_html
|
render_inline(described_class.new(batch: batch_operation, procedure:)).to_html
|
||||||
expect(batch_operation.seen_at).not_to eq(nil)
|
expect(batch_operation.seen_at).not_to eq(nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -396,7 +405,7 @@ RSpec.describe Dossiers::BatchAlertComponent, type: :component do
|
||||||
it { expect(batch_operation.seen_at).to eq(nil) }
|
it { expect(batch_operation.seen_at).to eq(nil) }
|
||||||
|
|
||||||
it 'on next render "seen_at" is set to avoid rendering alert' do
|
it 'on next render "seen_at" is set to avoid rendering alert' do
|
||||||
render_inline(component).to_html
|
render_inline(described_class.new(batch: batch_operation, procedure:)).to_html
|
||||||
expect(batch_operation.seen_at).not_to eq(nil)
|
expect(batch_operation.seen_at).not_to eq(nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -450,7 +459,7 @@ RSpec.describe Dossiers::BatchAlertComponent, type: :component do
|
||||||
it { expect(batch_operation.seen_at).to eq(nil) }
|
it { expect(batch_operation.seen_at).to eq(nil) }
|
||||||
|
|
||||||
it 'on next render "seen_at" is set to avoid rendering alert' do
|
it 'on next render "seen_at" is set to avoid rendering alert' do
|
||||||
render_inline(component).to_html
|
render_inline(described_class.new(batch: batch_operation, procedure:)).to_html
|
||||||
expect(batch_operation.seen_at).not_to eq(nil)
|
expect(batch_operation.seen_at).not_to eq(nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -504,7 +513,7 @@ RSpec.describe Dossiers::BatchAlertComponent, type: :component do
|
||||||
it { expect(batch_operation.seen_at).to eq(nil) }
|
it { expect(batch_operation.seen_at).to eq(nil) }
|
||||||
|
|
||||||
it 'on next render "seen_at" is set to avoid rendering alert' do
|
it 'on next render "seen_at" is set to avoid rendering alert' do
|
||||||
render_inline(component).to_html
|
render_inline(described_class.new(batch: batch_operation, procedure:)).to_html
|
||||||
expect(batch_operation.seen_at).not_to eq(nil)
|
expect(batch_operation.seen_at).not_to eq(nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -558,7 +567,7 @@ RSpec.describe Dossiers::BatchAlertComponent, type: :component do
|
||||||
it { expect(batch_operation.seen_at).to eq(nil) }
|
it { expect(batch_operation.seen_at).to eq(nil) }
|
||||||
|
|
||||||
it 'on next render "seen_at" is set to avoid rendering alert' do
|
it 'on next render "seen_at" is set to avoid rendering alert' do
|
||||||
render_inline(component).to_html
|
render_inline(described_class.new(batch: batch_operation, procedure:)).to_html
|
||||||
expect(batch_operation.seen_at).not_to eq(nil)
|
expect(batch_operation.seen_at).not_to eq(nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -612,7 +621,7 @@ RSpec.describe Dossiers::BatchAlertComponent, type: :component do
|
||||||
it { expect(batch_operation.seen_at).to eq(nil) }
|
it { expect(batch_operation.seen_at).to eq(nil) }
|
||||||
|
|
||||||
it 'on next render "seen_at" is set to avoid rendering alert' do
|
it 'on next render "seen_at" is set to avoid rendering alert' do
|
||||||
render_inline(component).to_html
|
render_inline(described_class.new(batch: batch_operation, procedure:)).to_html
|
||||||
expect(batch_operation.seen_at).not_to eq(nil)
|
expect(batch_operation.seen_at).not_to eq(nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,6 +10,10 @@ RSpec.describe Dossiers::MessageComponent, type: :component do
|
||||||
groupe_gestionnaire: groupe_gestionnaire
|
groupe_gestionnaire: groupe_gestionnaire
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
before do
|
||||||
|
allow(component).to receive(:params).and_return({ statut: 'a-suivre' })
|
||||||
|
end
|
||||||
|
|
||||||
let(:seen_at) { commentaire.created_at + 1.hour }
|
let(:seen_at) { commentaire.created_at + 1.hour }
|
||||||
|
|
||||||
describe 'for dossier' do
|
describe 'for dossier' do
|
||||||
|
@ -230,7 +234,7 @@ RSpec.describe Dossiers::MessageComponent, type: :component do
|
||||||
|
|
||||||
describe 'delete message button for gestionnaire' do
|
describe 'delete message button for gestionnaire' do
|
||||||
let(:connected_user) { gestionnaire }
|
let(:connected_user) { gestionnaire }
|
||||||
let(:form_url) { component.helpers.gestionnaire_groupe_gestionnaire_commentaire_path(groupe_gestionnaire, commentaire) }
|
let(:form_url) { component.helpers.gestionnaire_groupe_gestionnaire_commentaire_path(groupe_gestionnaire, commentaire, statut: 'a-suivre') }
|
||||||
|
|
||||||
context 'when commentaire had been written by connected gestionnaire' do
|
context 'when commentaire had been written by connected gestionnaire' do
|
||||||
it { is_expected.to have_selector("form[action=\"#{form_url}\"]") }
|
it { is_expected.to have_selector("form[action=\"#{form_url}\"]") }
|
||||||
|
|
|
@ -4,7 +4,9 @@ RSpec.describe Instructeurs::EnConstructionMenuComponent, type: :component do
|
||||||
include DossierHelper
|
include DossierHelper
|
||||||
|
|
||||||
subject do
|
subject do
|
||||||
render_inline(described_class.new(dossier:))
|
component = described_class.new(dossier:)
|
||||||
|
allow(component).to receive(:statut).and_return('a-suivre')
|
||||||
|
render_inline(component)
|
||||||
end
|
end
|
||||||
|
|
||||||
matcher :have_dropdown_title do |expected_title|
|
matcher :have_dropdown_title do |expected_title|
|
||||||
|
|
|
@ -19,7 +19,7 @@ describe Instructeurs::AvisController, type: :controller do
|
||||||
let!(:avis) { create(:avis, dossier: dossier, claimant: instructeur, experts_procedure: experts_procedure) }
|
let!(:avis) { create(:avis, dossier: dossier, claimant: instructeur, experts_procedure: experts_procedure) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
patch :revoquer, params: { procedure_id: procedure.id, id: avis.id }
|
patch :revoquer, params: { procedure_id: procedure.id, id: avis.id, statut: 'a-suivre' }
|
||||||
end
|
end
|
||||||
|
|
||||||
it "revoke the dossier" do
|
it "revoke the dossier" do
|
||||||
|
@ -35,7 +35,7 @@ describe Instructeurs::AvisController, type: :controller do
|
||||||
let!(:avis) { create(:avis, dossier: dossier, claimant: instructeur, experts_procedure: experts_procedure) }
|
let!(:avis) { create(:avis, dossier: dossier, claimant: instructeur, experts_procedure: experts_procedure) }
|
||||||
|
|
||||||
it 'sends a reminder to the expert' do
|
it 'sends a reminder to the expert' do
|
||||||
get :remind, params: { procedure_id: procedure.id, id: avis.id }
|
get :remind, params: { procedure_id: procedure.id, id: avis.id, statut: 'a-suivre' }
|
||||||
expect(AvisMailer).to have_received(:avis_invitation_and_confirm_email)
|
expect(AvisMailer).to have_received(:avis_invitation_and_confirm_email)
|
||||||
expect(flash.notice).to eq("Un mail de relance a été envoyé à #{avis.expert.email}")
|
expect(flash.notice).to eq("Un mail de relance a été envoyé à #{avis.expert.email}")
|
||||||
expect(avis.reload.reminded_at).to be_present
|
expect(avis.reload.reminded_at).to be_present
|
||||||
|
@ -46,7 +46,7 @@ describe Instructeurs::AvisController, type: :controller do
|
||||||
let!(:avis) { create(:avis, dossier: dossier, claimant: instructeur, experts_procedure: experts_procedure, question_label: '123') }
|
let!(:avis) { create(:avis, dossier: dossier, claimant: instructeur, experts_procedure: experts_procedure, question_label: '123') }
|
||||||
|
|
||||||
it 'sends a reminder to the expert' do
|
it 'sends a reminder to the expert' do
|
||||||
get :remind, params: { procedure_id: procedure.id, id: avis.id }
|
get :remind, params: { procedure_id: procedure.id, id: avis.id, statut: 'a-suivre' }
|
||||||
expect(AvisMailer).to have_received(:avis_invitation_and_confirm_email)
|
expect(AvisMailer).to have_received(:avis_invitation_and_confirm_email)
|
||||||
expect(flash.notice).to eq("Un mail de relance a été envoyé à #{avis.expert.email}")
|
expect(flash.notice).to eq("Un mail de relance a été envoyé à #{avis.expert.email}")
|
||||||
expect(avis.reload.reminded_at).to be_present
|
expect(avis.reload.reminded_at).to be_present
|
||||||
|
|
|
@ -10,7 +10,8 @@ describe Instructeurs::BatchOperationsController, type: :controller do
|
||||||
batch_operation: {
|
batch_operation: {
|
||||||
operation: BatchOperation.operations.fetch(:archiver),
|
operation: BatchOperation.operations.fetch(:archiver),
|
||||||
dossier_ids: [dossier.id]
|
dossier_ids: [dossier.id]
|
||||||
}
|
},
|
||||||
|
statut: 'a-suivre'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -20,7 +21,10 @@ describe Instructeurs::BatchOperationsController, type: :controller do
|
||||||
|
|
||||||
context 'ACL' do
|
context 'ACL' do
|
||||||
let(:params) do
|
let(:params) do
|
||||||
{ procedure_id: create(:procedure).id }
|
{
|
||||||
|
procedure_id: create(:procedure).id,
|
||||||
|
statut: 'a-suivre'
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'fails when procedure does not belongs to instructeur' do
|
it 'fails when procedure does not belongs to instructeur' do
|
||||||
|
|
|
@ -13,7 +13,7 @@ describe Instructeurs::CommentairesController, type: :controller do
|
||||||
describe 'destroy' do
|
describe 'destroy' do
|
||||||
context 'when it works' do
|
context 'when it works' do
|
||||||
let(:commentaire) { create(:commentaire, instructeur: instructeur, dossier: dossier) }
|
let(:commentaire) { create(:commentaire, instructeur: instructeur, dossier: dossier) }
|
||||||
subject { delete :destroy, params: { dossier_id: dossier.id, procedure_id: procedure.id, id: commentaire.id }, format: :turbo_stream }
|
subject { delete :destroy, params: { dossier_id: dossier.id, procedure_id: procedure.id, id: commentaire.id, statut: 'a-suivre' }, format: :turbo_stream }
|
||||||
|
|
||||||
it 'respond with OK and flash' do
|
it 'respond with OK and flash' do
|
||||||
expect(subject).to have_http_status(:ok)
|
expect(subject).to have_http_status(:ok)
|
||||||
|
@ -48,7 +48,7 @@ describe Instructeurs::CommentairesController, type: :controller do
|
||||||
|
|
||||||
context 'when dossier had been discarded' do
|
context 'when dossier had been discarded' do
|
||||||
let(:commentaire) { create(:commentaire, instructeur: instructeur, dossier: dossier, discarded_at: 2.hours.ago) }
|
let(:commentaire) { create(:commentaire, instructeur: instructeur, dossier: dossier, discarded_at: 2.hours.ago) }
|
||||||
subject { delete :destroy, params: { dossier_id: dossier.id, procedure_id: procedure.id, id: commentaire.id }, format: :turbo_stream }
|
subject { delete :destroy, params: { dossier_id: dossier.id, procedure_id: procedure.id, id: commentaire.id, statut: 'a-suivre' }, format: :turbo_stream }
|
||||||
|
|
||||||
it 'respond with OK and flash' do
|
it 'respond with OK and flash' do
|
||||||
expect(subject).to have_http_status(:ok)
|
expect(subject).to have_http_status(:ok)
|
||||||
|
@ -65,7 +65,7 @@ describe Instructeurs::CommentairesController, type: :controller do
|
||||||
describe 'destroy' do
|
describe 'destroy' do
|
||||||
context 'when it works' do
|
context 'when it works' do
|
||||||
let(:commentaire) { create(:commentaire, expert: expert, dossier: dossier) }
|
let(:commentaire) { create(:commentaire, expert: expert, dossier: dossier) }
|
||||||
subject { delete :destroy, params: { dossier_id: dossier.id, procedure_id: procedure.id, id: commentaire.id }, format: :turbo_stream }
|
subject { delete :destroy, params: { dossier_id: dossier.id, procedure_id: procedure.id, id: commentaire.id, statut: 'a-suivre' }, format: :turbo_stream }
|
||||||
|
|
||||||
it 'respond with OK and flash' do
|
it 'respond with OK and flash' do
|
||||||
expect(subject).to have_http_status(:ok)
|
expect(subject).to have_http_status(:ok)
|
||||||
|
|
|
@ -33,7 +33,8 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
params: {
|
params: {
|
||||||
recipients: [recipient.id],
|
recipients: [recipient.id],
|
||||||
procedure_id: procedure.id,
|
procedure_id: procedure.id,
|
||||||
dossier_id: dossier.id
|
dossier_id: dossier.id,
|
||||||
|
statut: 'a-suivre'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -64,7 +65,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
|
|
||||||
subject do
|
subject do
|
||||||
batch_operation
|
batch_operation
|
||||||
patch :follow, params: { procedure_id: procedure.id, dossier_id: dossier.id }
|
patch :follow, params: { procedure_id: procedure.id, dossier_id: dossier.id, statut: 'a-suivre' }
|
||||||
end
|
end
|
||||||
|
|
||||||
it do
|
it do
|
||||||
|
@ -93,7 +94,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
|
|
||||||
subject do
|
subject do
|
||||||
batch_operation
|
batch_operation
|
||||||
patch :unfollow, params: { procedure_id: procedure.id, dossier_id: dossier.id }
|
patch :unfollow, params: { procedure_id: procedure.id, dossier_id: dossier.id, statut: 'a-suivre' }
|
||||||
end
|
end
|
||||||
|
|
||||||
it do
|
it do
|
||||||
|
@ -121,7 +122,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
let(:batch_operation) {}
|
let(:batch_operation) {}
|
||||||
before do
|
before do
|
||||||
batch_operation
|
batch_operation
|
||||||
patch :archive, params: { procedure_id: procedure.id, dossier_id: dossier.id }
|
patch :archive, params: { procedure_id: procedure.id, dossier_id: dossier.id, statut: 'a-suivre' }
|
||||||
dossier.reload
|
dossier.reload
|
||||||
instructeur.follow(dossier)
|
instructeur.follow(dossier)
|
||||||
end
|
end
|
||||||
|
@ -142,7 +143,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
before do
|
before do
|
||||||
batch_operation
|
batch_operation
|
||||||
dossier.update(archived: true)
|
dossier.update(archived: true)
|
||||||
patch :unarchive, params: { procedure_id: procedure.id, dossier_id: dossier.id }
|
patch :unarchive, params: { procedure_id: procedure.id, dossier_id: dossier.id, statut: 'a-suivre' }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(dossier.reload.archived).to eq(false) }
|
it { expect(dossier.reload.archived).to eq(false) }
|
||||||
|
@ -162,7 +163,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
before do
|
before do
|
||||||
batch_operation
|
batch_operation
|
||||||
sign_in(instructeur.user)
|
sign_in(instructeur.user)
|
||||||
post :passer_en_instruction, params: { procedure_id: procedure.id, dossier_id: dossier.id }, format: :turbo_stream
|
post :passer_en_instruction, params: { procedure_id: procedure.id, dossier_id: dossier.id, statut: 'a-suivre' }, format: :turbo_stream
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(dossier.reload.state).to eq(Dossier.states.fetch(:en_instruction)) }
|
it { expect(dossier.reload.state).to eq(Dossier.states.fetch(:en_instruction)) }
|
||||||
|
@ -208,7 +209,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
batch_operation
|
batch_operation
|
||||||
sign_in(instructeur.user)
|
sign_in(instructeur.user)
|
||||||
post :repasser_en_construction,
|
post :repasser_en_construction,
|
||||||
params: { procedure_id: procedure.id, dossier_id: dossier.id },
|
params: { procedure_id: procedure.id, dossier_id: dossier.id, statut: 'a-suivre' },
|
||||||
format: :turbo_stream
|
format: :turbo_stream
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -243,7 +244,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
sign_in current_user
|
sign_in current_user
|
||||||
batch_operation
|
batch_operation
|
||||||
post :repasser_en_instruction,
|
post :repasser_en_instruction,
|
||||||
params: { procedure_id: procedure.id, dossier_id: dossier.id },
|
params: { procedure_id: procedure.id, dossier_id: dossier.id, statut: 'a-suivre' },
|
||||||
format: :turbo_stream
|
format: :turbo_stream
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -297,7 +298,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'simple refusal' do
|
context 'simple refusal' do
|
||||||
subject { post :terminer, params: { process_action: "refuser", procedure_id: procedure.id, dossier_id: dossier.id }, format: :turbo_stream }
|
subject { post :terminer, params: { process_action: "refuser", procedure_id: procedure.id, dossier_id: dossier.id, statut: 'a-suivre' }, format: :turbo_stream }
|
||||||
|
|
||||||
it 'change state to refuse' do
|
it 'change state to refuse' do
|
||||||
subject
|
subject
|
||||||
|
@ -321,7 +322,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'refusal with a justificatif' do
|
context 'refusal with a justificatif' do
|
||||||
subject { post :terminer, params: { process_action: "refuser", procedure_id: procedure.id, dossier_id: dossier.id, dossier: { justificatif_motivation: fake_justificatif } }, format: :turbo_stream }
|
subject { post :terminer, params: { process_action: "refuser", procedure_id: procedure.id, dossier_id: dossier.id, dossier: { justificatif_motivation: fake_justificatif }, statut: 'a-suivre' }, format: :turbo_stream }
|
||||||
|
|
||||||
it 'attachs a justificatif' do
|
it 'attachs a justificatif' do
|
||||||
subject
|
subject
|
||||||
|
@ -336,7 +337,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
|
|
||||||
context 'with dossier in batch_operation' do
|
context 'with dossier in batch_operation' do
|
||||||
let!(:batch_operation) { create(:batch_operation, operation: :archiver, dossiers: [dossier], instructeur: instructeur) }
|
let!(:batch_operation) { create(:batch_operation, operation: :archiver, dossiers: [dossier], instructeur: instructeur) }
|
||||||
subject { post :terminer, params: { process_action: "refuser", procedure_id: procedure.id, dossier_id: dossier.id }, format: :turbo_stream }
|
subject { post :terminer, params: { process_action: "refuser", procedure_id: procedure.id, dossier_id: dossier.id, statut: 'a-suivre' }, format: :turbo_stream }
|
||||||
|
|
||||||
it { expect { subject }.not_to change { dossier.reload.state } }
|
it { expect { subject }.not_to change { dossier.reload.state } }
|
||||||
it { is_expected.to redirect_to(instructeur_dossier_path(dossier.procedure, dossier)) }
|
it { is_expected.to redirect_to(instructeur_dossier_path(dossier.procedure, dossier)) }
|
||||||
|
@ -353,7 +354,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
sign_in(instructeur.user)
|
sign_in(instructeur.user)
|
||||||
end
|
end
|
||||||
context 'without continuation' do
|
context 'without continuation' do
|
||||||
subject { post :terminer, params: { process_action: "classer_sans_suite", procedure_id: procedure.id, dossier_id: dossier_for_tiers.id }, format: :turbo_stream }
|
subject { post :terminer, params: { process_action: "classer_sans_suite", procedure_id: procedure.id, dossier_id: dossier_for_tiers.id, statut: 'a-suivre' }, format: :turbo_stream }
|
||||||
|
|
||||||
it 'Notification email is sent' do
|
it 'Notification email is sent' do
|
||||||
expect(NotificationMailer).to receive(:send_sans_suite_notification)
|
expect(NotificationMailer).to receive(:send_sans_suite_notification)
|
||||||
|
@ -379,7 +380,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
sign_in(instructeur.user)
|
sign_in(instructeur.user)
|
||||||
end
|
end
|
||||||
context 'without continuation' do
|
context 'without continuation' do
|
||||||
subject { post :terminer, params: { process_action: "classer_sans_suite", procedure_id: procedure.id, dossier_id: dossier_for_tiers_without_notif.id }, format: :turbo_stream }
|
subject { post :terminer, params: { process_action: "classer_sans_suite", procedure_id: procedure.id, dossier_id: dossier_for_tiers_without_notif.id, statut: 'a-suivre' }, format: :turbo_stream }
|
||||||
|
|
||||||
it 'Notification email is sent' do
|
it 'Notification email is sent' do
|
||||||
expect(NotificationMailer).to receive(:send_sans_suite_notification)
|
expect(NotificationMailer).to receive(:send_sans_suite_notification)
|
||||||
|
@ -405,7 +406,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
sign_in(instructeur.user)
|
sign_in(instructeur.user)
|
||||||
end
|
end
|
||||||
context 'with classer_sans_suite' do
|
context 'with classer_sans_suite' do
|
||||||
subject { post :terminer, params: { process_action: "classer_sans_suite", procedure_id: procedure_accuse_lecture.id, dossier_id: dossier_accuse_lecture.id }, format: :turbo_stream }
|
subject { post :terminer, params: { process_action: "classer_sans_suite", procedure_id: procedure_accuse_lecture.id, dossier_id: dossier_accuse_lecture.id, statut: 'a-suivre' }, format: :turbo_stream }
|
||||||
|
|
||||||
it 'Notification accuse de lecture email is sent and not the others' do
|
it 'Notification accuse de lecture email is sent and not the others' do
|
||||||
expect(NotificationMailer).to receive(:send_accuse_lecture_notification)
|
expect(NotificationMailer).to receive(:send_accuse_lecture_notification)
|
||||||
|
@ -433,7 +434,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
sign_in(instructeur.user)
|
sign_in(instructeur.user)
|
||||||
end
|
end
|
||||||
context 'without attachment' do
|
context 'without attachment' do
|
||||||
subject { post :terminer, params: { process_action: "classer_sans_suite", procedure_id: procedure.id, dossier_id: dossier.id }, format: :turbo_stream }
|
subject { post :terminer, params: { process_action: "classer_sans_suite", procedure_id: procedure.id, dossier_id: dossier.id, statut: 'a-suivre' }, format: :turbo_stream }
|
||||||
|
|
||||||
it 'change state to sans_suite' do
|
it 'change state to sans_suite' do
|
||||||
subject
|
subject
|
||||||
|
@ -458,7 +459,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with attachment' do
|
context 'with attachment' do
|
||||||
subject { post :terminer, params: { process_action: "classer_sans_suite", procedure_id: procedure.id, dossier_id: dossier.id, dossier: { justificatif_motivation: fake_justificatif } }, format: :turbo_stream }
|
subject { post :terminer, params: { process_action: "classer_sans_suite", procedure_id: procedure.id, dossier_id: dossier.id, statut: 'a-suivre', dossier: { justificatif_motivation: fake_justificatif } }, format: :turbo_stream }
|
||||||
|
|
||||||
it 'change state to sans_suite' do
|
it 'change state to sans_suite' do
|
||||||
subject
|
subject
|
||||||
|
@ -484,7 +485,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
expect(NotificationMailer).to receive(:deliver_later)
|
expect(NotificationMailer).to receive(:deliver_later)
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { post :terminer, params: { process_action: "accepter", procedure_id: procedure.id, dossier_id: dossier.id }, format: :turbo_stream }
|
subject { post :terminer, params: { process_action: "accepter", procedure_id: procedure.id, dossier_id: dossier.id, statut: 'a-suivre' }, format: :turbo_stream }
|
||||||
|
|
||||||
it 'change state to accepte' do
|
it 'change state to accepte' do
|
||||||
subject
|
subject
|
||||||
|
@ -532,7 +533,8 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
process_action: "accepter",
|
process_action: "accepter",
|
||||||
procedure_id: procedure.id,
|
procedure_id: procedure.id,
|
||||||
dossier_id: dossier.id,
|
dossier_id: dossier.id,
|
||||||
dossier: { motivation: "Yallah" }
|
dossier: { motivation: "Yallah" },
|
||||||
|
statut: 'a-suivre'
|
||||||
}, format: :turbo_stream
|
}, format: :turbo_stream
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -546,7 +548,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with an attachment' do
|
context 'with an attachment' do
|
||||||
subject { post :terminer, params: { process_action: "accepter", procedure_id: procedure.id, dossier_id: dossier.id, dossier: { justificatif_motivation: fake_justificatif } }, format: :turbo_stream }
|
subject { post :terminer, params: { process_action: "accepter", procedure_id: procedure.id, dossier_id: dossier.id, dossier: { justificatif_motivation: fake_justificatif }, statut: 'a-suivre' }, format: :turbo_stream }
|
||||||
|
|
||||||
it 'change state to accepte' do
|
it 'change state to accepte' do
|
||||||
subject
|
subject
|
||||||
|
@ -564,7 +566,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
let(:procedure) { create(:procedure, :published, for_individual: false, instructeurs: instructeurs) }
|
let(:procedure) { create(:procedure, :published, for_individual: false, instructeurs: instructeurs) }
|
||||||
let(:dossier) { create(:dossier, :en_instruction, :with_entreprise, procedure: procedure, as_degraded_mode: true) }
|
let(:dossier) { create(:dossier, :en_instruction, :with_entreprise, procedure: procedure, as_degraded_mode: true) }
|
||||||
|
|
||||||
subject { post :terminer, params: { process_action: "accepter", procedure_id: procedure.id, dossier_id: dossier.id }, format: :turbo_stream }
|
subject { post :terminer, params: { process_action: "accepter", procedure_id: procedure.id, dossier_id: dossier.id, statut: 'a-suivre' }, format: :turbo_stream }
|
||||||
|
|
||||||
context "with accepter" do
|
context "with accepter" do
|
||||||
it 'warns about the error' do
|
it 'warns about the error' do
|
||||||
|
@ -583,7 +585,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
|
|
||||||
before { allow(dossier).to receive(:after_accepter) }
|
before { allow(dossier).to receive(:after_accepter) }
|
||||||
|
|
||||||
subject { post :terminer, params: { process_action: "accepter", procedure_id: procedure.id, dossier_id: dossier.id, dossier: { justificatif_motivation: fake_justificatif } }, format: :turbo_stream }
|
subject { post :terminer, params: { process_action: "accepter", procedure_id: procedure.id, dossier_id: dossier.id, dossier: { justificatif_motivation: fake_justificatif }, statut: 'a-suivre' }, format: :turbo_stream }
|
||||||
|
|
||||||
it 'does not close it again' do
|
it 'does not close it again' do
|
||||||
subject
|
subject
|
||||||
|
@ -604,7 +606,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
|
|
||||||
subject do
|
subject do
|
||||||
post :pending_correction, params: {
|
post :pending_correction, params: {
|
||||||
procedure_id: procedure.id, dossier_id: dossier.id,
|
procedure_id: procedure.id, dossier_id: dossier.id, statut: 'a-suivre',
|
||||||
dossier: { motivation: message, justificatif_motivation: justificatif },
|
dossier: { motivation: message, justificatif_motivation: justificatif },
|
||||||
reason:
|
reason:
|
||||||
}, format: :turbo_stream
|
}, format: :turbo_stream
|
||||||
|
@ -713,7 +715,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
|
|
||||||
describe '#messagerie' do
|
describe '#messagerie' do
|
||||||
before { expect(controller.current_instructeur).to receive(:mark_tab_as_seen).with(dossier, :messagerie) }
|
before { expect(controller.current_instructeur).to receive(:mark_tab_as_seen).with(dossier, :messagerie) }
|
||||||
subject { get :messagerie, params: { procedure_id: procedure.id, dossier_id: dossier.id } }
|
subject { get :messagerie, params: { procedure_id: procedure.id, dossier_id: dossier.id, statut: 'a-suivre' } }
|
||||||
it { expect(subject).to have_http_status(:ok) }
|
it { expect(subject).to have_http_status(:ok) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -731,7 +733,8 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
commentaire: {
|
commentaire: {
|
||||||
body: body,
|
body: body,
|
||||||
file: file
|
file: file
|
||||||
}
|
},
|
||||||
|
statut: 'a-suivre'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -794,7 +797,8 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
post :create_avis, params: {
|
post :create_avis, params: {
|
||||||
procedure_id: procedure.id,
|
procedure_id: procedure.id,
|
||||||
dossier_id: dossier.id,
|
dossier_id: dossier.id,
|
||||||
avis: { emails: emails, introduction: 'intro', confidentiel: true, invite_linked_dossiers: invite_linked_dossiers, claimant: instructeur, experts_procedure: experts_procedure }
|
avis: { emails: emails, introduction: 'intro', confidentiel: true, invite_linked_dossiers: invite_linked_dossiers, claimant: instructeur, experts_procedure: experts_procedure },
|
||||||
|
statut: 'a-suivre'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -949,6 +953,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
get :show, params: {
|
get :show, params: {
|
||||||
procedure_id: procedure.id,
|
procedure_id: procedure.id,
|
||||||
dossier_id: dossier.id,
|
dossier_id: dossier.id,
|
||||||
|
statut: 'a-suivre',
|
||||||
format: :pdf
|
format: :pdf
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -973,7 +978,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
context 'with dossier in batch_operation' do
|
context 'with dossier in batch_operation' do
|
||||||
let!(:batch_operation) { create(:batch_operation, operation: :archiver, dossiers: [dossier], instructeur: instructeur) }
|
let!(:batch_operation) { create(:batch_operation, operation: :archiver, dossiers: [dossier], instructeur: instructeur) }
|
||||||
it 'assigns variable with true value' do
|
it 'assigns variable with true value' do
|
||||||
get :show, params: { procedure_id: procedure.id, dossier_id: dossier.id }
|
get :show, params: { procedure_id: procedure.id, dossier_id: dossier.id, statut: 'a-suivre' }
|
||||||
expect(assigns(:is_dossier_in_batch_operation)).to eq(true)
|
expect(assigns(:is_dossier_in_batch_operation)).to eq(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1181,7 +1186,8 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
batch_operation
|
batch_operation
|
||||||
delete :destroy, params: {
|
delete :destroy, params: {
|
||||||
procedure_id: procedure.id,
|
procedure_id: procedure.id,
|
||||||
dossier_id: dossier.id
|
dossier_id: dossier.id,
|
||||||
|
statut: 'a-suivre'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1267,7 +1273,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#extend_conservation' do
|
describe '#extend_conservation' do
|
||||||
subject { post :extend_conservation, params: { procedure_id: procedure.id, dossier_id: dossier.id } }
|
subject { post :extend_conservation, params: { procedure_id: procedure.id, dossier_id: dossier.id, statut: 'a-suivre' } }
|
||||||
context 'when user logged in' do
|
context 'when user logged in' do
|
||||||
it 'works' do
|
it 'works' do
|
||||||
expect(subject).to redirect_to(instructeur_dossier_path(procedure, dossier))
|
expect(subject).to redirect_to(instructeur_dossier_path(procedure, dossier))
|
||||||
|
@ -1308,7 +1314,8 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
patch :restore,
|
patch :restore,
|
||||||
params: {
|
params: {
|
||||||
procedure_id: procedure.id,
|
procedure_id: procedure.id,
|
||||||
dossier_id: dossier.id
|
dossier_id: dossier.id,
|
||||||
|
statut: 'a-suivre'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1325,7 +1332,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#extend_conservation and restore' do
|
describe '#extend_conservation and restore' do
|
||||||
subject { post :extend_conservation_and_restore, params: { procedure_id: procedure.id, dossier_id: dossier.id } }
|
subject { post :extend_conservation_and_restore, params: { procedure_id: procedure.id, dossier_id: dossier.id, statut: 'a-suivre' } }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
dossier.update(hidden_by_expired_at: 1.hour.ago, hidden_by_reason: 'expired')
|
dossier.update(hidden_by_expired_at: 1.hour.ago, hidden_by_reason: 'expired')
|
||||||
|
@ -1398,7 +1405,8 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
post :reaffectation,
|
post :reaffectation,
|
||||||
params: {
|
params: {
|
||||||
procedure_id: procedure.id,
|
procedure_id: procedure.id,
|
||||||
dossier_id: dossier.id
|
dossier_id: dossier.id,
|
||||||
|
statut: 'a-suivre'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1423,7 +1431,8 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
params: {
|
params: {
|
||||||
procedure_id: procedure.id,
|
procedure_id: procedure.id,
|
||||||
dossier_id: dossier.id,
|
dossier_id: dossier.id,
|
||||||
groupe_instructeur_id: gi_2.id
|
groupe_instructeur_id: gi_2.id,
|
||||||
|
statut: 'a-suivre'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1458,7 +1467,8 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
get :personnes_impliquees,
|
get :personnes_impliquees,
|
||||||
params: {
|
params: {
|
||||||
procedure_id: routed_procedure.id,
|
procedure_id: routed_procedure.id,
|
||||||
dossier_id: dossier.id
|
dossier_id: dossier.id,
|
||||||
|
statut: 'a-suivre'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1514,7 +1524,8 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
|
|
||||||
get :pieces_jointes, params: {
|
get :pieces_jointes, params: {
|
||||||
procedure_id: procedure.id,
|
procedure_id: procedure.id,
|
||||||
dossier_id: dossier.id
|
dossier_id: dossier.id,
|
||||||
|
statut: 'a-suivre'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1535,7 +1546,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
let(:procedure) { create(:procedure, :with_labels, instructeurs: [instructeur]) }
|
let(:procedure) { create(:procedure, :with_labels, instructeurs: [instructeur]) }
|
||||||
let!(:dossier) { create(:dossier, :en_construction, procedure:) }
|
let!(:dossier) { create(:dossier, :en_construction, procedure:) }
|
||||||
context 'it create dossier labels' do
|
context 'it create dossier labels' do
|
||||||
subject { post :dossier_labels, params: { procedure_id: procedure.id, dossier_id: dossier.id, label_id: [Label.first.id] }, format: :turbo_stream }
|
subject { post :dossier_labels, params: { procedure_id: procedure.id, dossier_id: dossier.id, label_id: [Label.first.id], statut: 'a-suivre' }, format: :turbo_stream }
|
||||||
it 'works' do
|
it 'works' do
|
||||||
subject
|
subject
|
||||||
dossier.reload
|
dossier.reload
|
||||||
|
@ -1551,7 +1562,7 @@ describe Instructeurs::DossiersController, type: :controller do
|
||||||
DossierLabel.create(dossier_id: dossier.id, label_id: dossier.procedure.labels.first.id)
|
DossierLabel.create(dossier_id: dossier.id, label_id: dossier.procedure.labels.first.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { post :dossier_labels, params: { procedure_id: procedure.id, dossier_id: dossier.id, label_id: [] }, format: :turbo_stream }
|
subject { post :dossier_labels, params: { procedure_id: procedure.id, dossier_id: dossier.id, label_id: [], statut: 'a-suivre' }, format: :turbo_stream }
|
||||||
|
|
||||||
it 'works' do
|
it 'works' do
|
||||||
expect(dossier.dossier_labels.count).to eq(1)
|
expect(dossier.dossier_labels.count).to eq(1)
|
||||||
|
|
|
@ -263,7 +263,7 @@ describe Instructeurs::ProceduresController, type: :controller do
|
||||||
let!(:gi_2) { create(:groupe_instructeur, label: '2', procedure: procedure) }
|
let!(:gi_2) { create(:groupe_instructeur, label: '2', procedure: procedure) }
|
||||||
let!(:gi_3) { create(:groupe_instructeur, label: '3', procedure: procedure) }
|
let!(:gi_3) { create(:groupe_instructeur, label: '3', procedure: procedure) }
|
||||||
|
|
||||||
let(:statut) { nil }
|
let(:statut) { 'a-suivre' }
|
||||||
|
|
||||||
subject do
|
subject do
|
||||||
get :show, params: { procedure_id: procedure.id, statut: statut }
|
get :show, params: { procedure_id: procedure.id, statut: statut }
|
||||||
|
|
|
@ -216,7 +216,7 @@ describe 'The routing with rules', js: true do
|
||||||
## on the dossier itself
|
## on the dossier itself
|
||||||
click_on 'suivi'
|
click_on 'suivi'
|
||||||
click_on litteraire_user.email
|
click_on litteraire_user.email
|
||||||
expect(page).to have_current_path(instructeur_dossier_path(procedure, litteraire_user.dossiers.first))
|
expect(page).to have_current_path(instructeur_dossier_path(procedure, litteraire_user.dossiers.first, statut: :suivis))
|
||||||
expect(page).to have_text('Annotations privées')
|
expect(page).to have_text('Annotations privées')
|
||||||
expect(find('.fr-tabs')).to have_css('span.notifications')
|
expect(find('.fr-tabs')).to have_css('span.notifications')
|
||||||
log_out
|
log_out
|
||||||
|
@ -231,7 +231,7 @@ describe 'The routing with rules', js: true do
|
||||||
|
|
||||||
# the instructeurs who belong to scientifique AND litteraire groups manage scientifique and litteraire dossiers
|
# the instructeurs who belong to scientifique AND litteraire groups manage scientifique and litteraire dossiers
|
||||||
register_instructeur_and_log_in(alain.email)
|
register_instructeur_and_log_in(alain.email)
|
||||||
visit instructeur_procedure_path(procedure, params: { statut: 'tous' })
|
visit instructeur_procedure_path(procedure, statut: 'tous')
|
||||||
expect(page).to have_text(litteraire_user.email)
|
expect(page).to have_text(litteraire_user.email)
|
||||||
expect(page).to have_text(scientifique_user.email)
|
expect(page).to have_text(scientifique_user.email)
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ describe 'The routing with rules', js: true do
|
||||||
click_on scientifique_user.email
|
click_on scientifique_user.email
|
||||||
click_on 'Suivre le dossier'
|
click_on 'Suivre le dossier'
|
||||||
|
|
||||||
visit instructeur_procedure_path(procedure, params: { statut: 'tous' })
|
visit instructeur_procedure_path(procedure, statut: 'tous')
|
||||||
click_on litteraire_user.email
|
click_on litteraire_user.email
|
||||||
click_on 'Suivre le dossier'
|
click_on 'Suivre le dossier'
|
||||||
log_out
|
log_out
|
||||||
|
|
|
@ -4,6 +4,7 @@ describe 'instructeurs/dossiers/instruction_button_motivation', type: :view do
|
||||||
let(:dossier) { create(:dossier, :en_instruction) }
|
let(:dossier) { create(:dossier, :en_instruction) }
|
||||||
|
|
||||||
subject do
|
subject do
|
||||||
|
allow(controller).to receive(:params).and_return(statut: 'a-suivre')
|
||||||
render(
|
render(
|
||||||
'instructeurs/dossiers/instruction_button_motivation',
|
'instructeurs/dossiers/instruction_button_motivation',
|
||||||
dossier: dossier,
|
dossier: dossier,
|
||||||
|
|
|
@ -7,6 +7,7 @@ describe 'instructeurs/dossiers/annotations_privees', type: :view do
|
||||||
before do
|
before do
|
||||||
sign_in(current_instructeur.user)
|
sign_in(current_instructeur.user)
|
||||||
allow(view).to receive(:current_instructeur).and_return(current_instructeur)
|
allow(view).to receive(:current_instructeur).and_return(current_instructeur)
|
||||||
|
allow(controller).to receive(:params).and_return({ statut: 'a-suivre' })
|
||||||
assign(:dossier, dossier)
|
assign(:dossier, dossier)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ describe 'instructeurs/dossiers/show', type: :view do
|
||||||
before do
|
before do
|
||||||
sign_in(current_instructeur.user)
|
sign_in(current_instructeur.user)
|
||||||
allow(view).to receive(:current_instructeur).and_return(current_instructeur)
|
allow(view).to receive(:current_instructeur).and_return(current_instructeur)
|
||||||
|
allow(controller).to receive(:params).and_return(statut: 'a-suivre')
|
||||||
assign(:dossier, dossier)
|
assign(:dossier, dossier)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
describe 'shared/avis/_list', type: :view do
|
describe 'shared/avis/_list', type: :view do
|
||||||
before { view.extend DossierHelper }
|
before do
|
||||||
|
view.extend DossierHelper
|
||||||
|
allow(view).to receive(:params).and_return({ statut: 'a-suivre' })
|
||||||
|
end
|
||||||
|
|
||||||
subject { render 'shared/avis/list', avis: avis, avis_seen_at: seen_at, expert_or_instructeur: instructeur }
|
subject { render 'shared/avis/list', avis: avis, avis_seen_at: seen_at, expert_or_instructeur: instructeur }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue