Add the possibility to disable weekly email notifications (instructeur) && rename the column email_notifications_enabled to daily_email_notification_enabled

This commit is contained in:
kara Diaby 2020-02-11 15:51:15 +01:00 committed by GitHub Action
parent 35b608fb7d
commit 0b8a59d5e9
6 changed files with 33 additions and 8 deletions

View file

@ -147,6 +147,21 @@ describe Instructeur, type: :model do
it { expect(instructeur2.last_week_overview[:procedure_overviews]).to match([procedure_overview]) }
end
context 'when a procedure published was active and weekly notifications is disable' do
let!(:procedure) { create(:procedure, :published, libelle: 'procedure') }
let(:procedure_overview) { double('procedure_overview', 'had_some_activities?'.to_sym => true) }
before :each do
instructeur2.assign_to_procedure(procedure)
AssignTo
.where(instructeur: instructeur2, groupe_instructeur: procedure.groupe_instructeurs.first)
.update(weekly_email_notifications_enabled: false)
allow_any_instance_of(Procedure).to receive(:procedure_overview).and_return(procedure_overview)
end
it { expect(instructeur2.last_week_overview).to be_nil }
end
context 'when a procedure not published was active with no notifications' do
let!(:procedure) { create(:procedure, libelle: 'procedure') }
let(:procedure_overview) { double('procedure_overview', 'had_some_activities?'.to_sym => true) }