refactor(virus_scan_result): use column instead of metadata on blob

This commit is contained in:
Paul Chavard 2022-12-22 18:20:58 +01:00
parent d469bca0ae
commit 6e18090fb3
17 changed files with 80 additions and 47 deletions

View file

@ -127,7 +127,7 @@ RSpec.describe Attachment::EditComponent, type: :component do
context 'with non nominal or final antivirus status' do
before do
champ.piece_justificative_file[0].blob.update(metadata: attachment.blob.metadata.merge(virus_scan_result: virus_scan_result))
champ.piece_justificative_file[0].blob.update(virus_scan_result:)
end
context 'when the anti-virus scan is pending' do

View file

@ -84,7 +84,7 @@ RSpec.describe Attachment::MultipleComponent, type: :component do
let(:created_at) { 1.second.ago }
before do
attached_file.attachments[0].blob.update(metadata: { virus_scan_result: ActiveStorage::VirusScanner::PENDING })
attached_file.attachments[0].blob.update(virus_scan_result: ActiveStorage::VirusScanner::PENDING)
attached_file.attachments[0].update!(created_at:)
end

View file

@ -48,7 +48,7 @@ RSpec.describe Attachment::PendingPollComponent, type: :component do
context "when antivirus is in progress" do
before do
attachment.blob[:metadata] = { virus_scan_result: ActiveStorage::VirusScanner::PENDING }
attachment.blob.virus_scan_result = ActiveStorage::VirusScanner::PENDING
end
it "renders" do

View file

@ -15,7 +15,7 @@ RSpec.describe Attachment::ShowComponent, type: :component do
subject { render_inline(component).to_html }
before do
champ.piece_justificative_file[0].blob.update(metadata: champ.piece_justificative_file[0].blob.metadata.merge(virus_scan_result: virus_scan_result))
attachment.blob.update(virus_scan_result:, metadata: attachment.blob.metadata.merge(virus_scan_result:))
end
context 'when there is no anti-virus scan' do