demarches-normaliennes/spec/models/champs/piece_justificative_champ_spec.rb
2019-02-19 18:10:35 +01:00

24 lines
608 B
Ruby

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' }
it { is_expected.to be_nil }
end
context 'when file is infected' do
let(:status) { 'infected' }
it { is_expected.to be_nil }
end
end
end