2019-07-01 15:55:37 +02:00
|
|
|
describe ActiveStorage::DownloadableFile do
|
2019-07-25 15:57:00 +02:00
|
|
|
let(:dossier) { create(:dossier) }
|
|
|
|
|
|
|
|
subject(:list) { ActiveStorage::DownloadableFile.create_list_from_dossier(dossier) }
|
2019-07-01 15:55:37 +02:00
|
|
|
|
|
|
|
describe 'create_list_from_dossier' do
|
|
|
|
context 'when no piece_justificative is present' do
|
|
|
|
it { expect(list).to match([]) }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when there is a piece_justificative' do
|
|
|
|
before do
|
2019-07-25 15:57:00 +02:00
|
|
|
dossier.champs << create(:champ, :piece_justificative, :with_piece_justificative_file)
|
2019-07-01 15:55:37 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it { expect(list.length).to be 1 }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|