test fonctionnel notification champ

This commit is contained in:
clemkeirua 2020-09-07 16:12:29 +02:00 committed by Keirua (Rebase PR Action)
parent 1fafcad401
commit b7b61e79ab

View file

@ -682,6 +682,22 @@ describe Users::DossiersController, type: :controller do
it { expect(dossier.reload.state).to eq(Dossier.states.fetch(:en_construction)) } it { expect(dossier.reload.state).to eq(Dossier.states.fetch(:en_construction)) }
it { expect(response).to redirect_to(demande_dossier_path(dossier)) } it { expect(response).to redirect_to(demande_dossier_path(dossier)) }
end end
context 'when the dossier is followed by an instructeur' do
let(:dossier) { create(:dossier) }
let(:instructeur) { create(:instructeur) }
let!(:invite) { create(:invite, dossier: dossier, user: user) }
before do
instructeur.follow(dossier)
end
it 'the follower has a notification' do
expect(instructeur.reload.followed_dossiers.with_notifications(instructeur)).to eq([])
subject
expect(instructeur.reload.followed_dossiers.with_notifications(instructeur)).to eq([dossier.reload])
end
end
end end
describe '#index' do describe '#index' do