Add a termine scope to Dossier
This commit is contained in:
parent
5e5a01cdc8
commit
0971ede57e
3 changed files with 3 additions and 2 deletions
|
@ -63,6 +63,7 @@ class Dossier < ActiveRecord::Base
|
|||
scope :waiting_for_user, -> { not_archived.state_waiting_for_user.order_by_updated_at(:asc) }
|
||||
scope :ouvert, -> { not_archived.state_ouvert.order_by_updated_at(:asc) }
|
||||
scope :a_instruire, -> { not_archived.state_a_instruire.order_by_updated_at(:asc) }
|
||||
scope :termine, -> { not_archived.state_termine.order_by_updated_at(:asc) }
|
||||
scope :downloadable, -> { state_not_brouillon.order_by_updated_at(:asc) }
|
||||
|
||||
accepts_nested_attributes_for :individual
|
||||
|
|
|
@ -45,7 +45,7 @@ class DossiersListGestionnaireService
|
|||
end
|
||||
|
||||
def termine
|
||||
@termine ||= filter_dossiers.state_termine.not_archived
|
||||
@termine ||= filter_dossiers.termine
|
||||
end
|
||||
|
||||
def filter_dossiers
|
||||
|
|
|
@ -364,7 +364,7 @@ describe DossiersListGestionnaireService do
|
|||
let!(:dossier14) { create(:dossier, procedure: procedure, state: 'closed', archived: true) } #termine #archived
|
||||
|
||||
describe '#termine' do
|
||||
subject { DossiersListGestionnaireService.new(gestionnaire, liste, procedure).state_termine }
|
||||
subject { DossiersListGestionnaireService.new(gestionnaire, liste, procedure).termine }
|
||||
|
||||
it { expect(subject.size).to eq(4) }
|
||||
it { expect(subject).to include(dossier8, dossier9, dossier10, dossier11) }
|
||||
|
|
Loading…
Reference in a new issue