Merge pull request #5073 from betagouv/fix-instructeur-procedures-list
Instructeur : corrige la présence de démarches supprimées dans la liste des démarches
This commit is contained in:
commit
48cb5bf305
2 changed files with 14 additions and 7 deletions
|
@ -8,6 +8,7 @@ module Instructeurs
|
|||
def index
|
||||
@procedures = current_instructeur
|
||||
.procedures
|
||||
.kept
|
||||
.with_attached_logo
|
||||
.includes(:defaut_groupe_instructeur)
|
||||
.order(closed_at: :desc, unpublished_at: :desc, published_at: :desc, created_at: :desc)
|
||||
|
|
|
@ -96,18 +96,24 @@ describe Instructeurs::ProceduresController, type: :controller do
|
|||
it { expect(response).to have_http_status(:ok) }
|
||||
|
||||
context "with procedures assigned" do
|
||||
let(:procedure1) { create(:procedure, :published) }
|
||||
let(:procedure2) { create(:procedure, :closed) }
|
||||
let(:procedure3) { create(:procedure) }
|
||||
let(:procedure_draft) { create(:procedure) }
|
||||
let(:procedure_published) { create(:procedure, :published) }
|
||||
let(:procedure_closed) { create(:procedure, :closed) }
|
||||
let(:procedure_draft_discarded) { create(:procedure, :discarded) }
|
||||
let(:procedure_closed_discarded) { create(:procedure, :discarded) }
|
||||
let(:procedure_not_assigned) { create(:procedure) }
|
||||
|
||||
before do
|
||||
instructeur.groupe_instructeurs << procedure1.defaut_groupe_instructeur
|
||||
instructeur.groupe_instructeurs << procedure2.defaut_groupe_instructeur
|
||||
instructeur.groupe_instructeurs << procedure3.defaut_groupe_instructeur
|
||||
[procedure_draft, procedure_published, procedure_closed, procedure_draft_discarded, procedure_closed_discarded].each do |p|
|
||||
instructeur.groupe_instructeurs << p.defaut_groupe_instructeur
|
||||
end
|
||||
subject
|
||||
end
|
||||
|
||||
it { expect(assigns(:procedures)).to include(procedure1, procedure2) }
|
||||
it 'assigns procedures visible to the instructeur' do
|
||||
expect(assigns(:procedures)).to include(procedure_draft, procedure_published, procedure_closed)
|
||||
expect(assigns(:procedures)).not_to include(procedure_draft_discarded, procedure_closed_discarded, procedure_not_assigned)
|
||||
end
|
||||
end
|
||||
|
||||
context "with dossiers" do
|
||||
|
|
Loading…
Reference in a new issue