Ensure that read notifications are not counted

This commit is contained in:
Mathieu Magnin 2017-05-10 18:10:43 +02:00
parent 459c2afe33
commit cfba1af7a4

View file

@ -288,6 +288,13 @@ describe Gestionnaire, type: :model do
it { is_expected.to eq(1) }
end
context 'when there is one notification read' do
let(:notification){ create(:notification, already_read: true) }
let!(:follow){ create(:follow, dossier: notification.dossier, gestionnaire: gestionnaire) }
it { is_expected.to eq(0) }
end
context 'when there are many notifications for one dossier' do
let(:notification){ create(:notification, already_read: false) }
let(:notification2){ create(:notification, already_read: false, dossier: notification.dossier) }