2019-02-05 20:57:58 +01:00
|
|
|
describe Champs::PieceJustificativeChamp do
|
|
|
|
describe '#for_api' do
|
|
|
|
let(:champ_pj) { create(:champ_piece_justificative) }
|
|
|
|
|
|
|
|
before { champ_pj.virus_scan.update(status: status) }
|
|
|
|
|
|
|
|
subject { champ_pj.for_api }
|
|
|
|
|
|
|
|
context 'when file is safe' do
|
|
|
|
let(:status) { 'safe' }
|
|
|
|
it { is_expected.to include("/rails/active_storage/blobs/") }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when file is not scanned' do
|
|
|
|
let(:status) { 'pending' }
|
2019-03-20 11:30:25 +01:00
|
|
|
it { is_expected.to include("/rails/active_storage/blobs/") }
|
2019-02-05 20:57:58 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'when file is infected' do
|
|
|
|
let(:status) { 'infected' }
|
|
|
|
it { is_expected.to be_nil }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|