From 61f3418f9f17501c74ba3df04a662a940a04af87 Mon Sep 17 00:00:00 2001 From: Paul Battley Date: Tue, 26 Nov 2024 17:34:37 +0000 Subject: [PATCH] Remove disabled email attachment specs These were disabled a year ago in commit d57130dc, which adds other tests for the behaviour of attachments. These specs are no longer needed nor useful. --- .../outlook_email_delivery_spec.rb | 47 ------------------- 1 file changed, 47 deletions(-) diff --git a/spec/integration/outlook_email_delivery_spec.rb b/spec/integration/outlook_email_delivery_spec.rb index d02e16060..9c3584544 100644 --- a/spec/integration/outlook_email_delivery_spec.rb +++ b/spec/integration/outlook_email_delivery_spec.rb @@ -141,51 +141,4 @@ end end end - - xdescribe "attached files" do - def as_adu(ffu) - ActionDispatch::Http::UploadedFile.new(tempfile: ffu.tempfile, filename: ffu.original_filename, type: ffu.content_type) - end - - describe "uploaded by the user" do - let(:file_attachments) { [as_adu(fixture_file_upload(Rails.root.join("spec/fixtures/support/text-file.txt"), "text/plain"))] } - - it "appear in the list of attachments" do - expect(draft_email.attachments.count).to eq(1) - expect(draft_email.attachments.first.content_type).to eq("text/plain") - expect(draft_email.attachments.first.name).to eq("text-file.txt") - expect(draft_email.attachments.first.content_bytes).to eq(Base64.encode64(file_attachments.first.tap(&:rewind).read)) - end - - context "when the file is infected" do - before { allow(Support::VirusScanner).to receive(:uploaded_file_safe?).and_return(false) } - - it "makes the email invalid" do - expect(draft_email).not_to be_valid - expect(draft_email.errors[:file_attachments]).to include("One or more of the files you uploaded contained a virus") - end - end - - context "when the file type is not accepted" do - let(:file_attachments) { [as_adu(fixture_file_upload(Rails.root.join("spec/fixtures/support/bad.php"), "application/x-httpd-php"))] } - - it "makes the email invalid" do - expect(draft_email).not_to be_valid - expect(draft_email.errors[:file_attachments]).to include("One or more of the files you uploaded was an incorrect file type") - end - end - end - - describe "coming from the email template" do - let(:template_attachment) { create(:support_email_template_attachment) } - let(:blob_attachments) { "[{\"file_id\": \"#{template_attachment.id}\", \"type\": \"Support::EmailTemplateAttachment\"}]" } - - it "appear in the list of attachments" do - expect(draft_email.attachments.count).to eq(1) - expect(draft_email.attachments.first.content_type).to eq("text/plain") - expect(draft_email.attachments.first.name).to eq("attachment.txt") - expect(draft_email.attachments.first.content_bytes).to eq(Base64.encode64(template_attachment.file.download)) - end - end - end end