instructors : receive daily emails for declarative folders
This commit is contained in:
parent
50af70ad7c
commit
395af2fbb0
5 changed files with 181 additions and 0 deletions
|
@ -47,6 +47,49 @@ describe NotificationService do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when a declarative dossier in instruction exists on this procedure' do
|
||||
let!(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
||||
before do
|
||||
procedure.update(declarative_with_state: "en_instruction")
|
||||
DeclarativeProceduresJob.new.perform
|
||||
dossier.reload
|
||||
end
|
||||
|
||||
it do
|
||||
subject
|
||||
expect(InstructeurMailer).to have_received(:send_notifications)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when a declarative dossier in accepte on yesterday exists on this procedure' do
|
||||
let!(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
||||
before do
|
||||
procedure.update(declarative_with_state: "accepte")
|
||||
DeclarativeProceduresJob.new.perform
|
||||
dossier.update(processed_at: Time.zone.yesterday.beginning_of_day)
|
||||
dossier.reload
|
||||
end
|
||||
|
||||
it do
|
||||
subject
|
||||
expect(InstructeurMailer).to have_received(:send_notifications)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when a declarative dossier in accepte on today exists on this procedure' do
|
||||
let!(:dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
||||
before do
|
||||
procedure.update(declarative_with_state: "accepte")
|
||||
DeclarativeProceduresJob.new.perform
|
||||
dossier.reload
|
||||
end
|
||||
|
||||
it do
|
||||
subject
|
||||
expect(InstructeurMailer).not_to have_received(:send_notifications)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when there is a notification on this procedure' do
|
||||
before do
|
||||
allow_any_instance_of(Instructeur).to receive(:notifications_for_procedure)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue