models: require belong_to associations on commentaire

This commit is contained in:
Pierre de La Morinerie 2020-07-20 16:34:42 +02:00
parent 32e55a6d37
commit dd1bed9340
3 changed files with 9 additions and 11 deletions

View file

@ -34,15 +34,17 @@ describe ActiveStorage::DownloadableFile do
end
context 'when there is a message with no attachment' do
let(:commentaire) { create(:commentaire) }
let(:dossier) { commentaire.dossier }
before do
dossier.commentaires << build(:commentaire, dossier: dossier)
end
it { expect(list.length).to eq 0 }
end
context 'when there is a message with an attachment' do
let(:commentaire) { create(:commentaire, :with_file) }
let(:dossier) { commentaire.dossier }
before do
dossier.commentaires << build(:commentaire, :with_file, dossier: dossier)
end
it { expect(list.length).to eq 1 }
end