Use file_validators to validate attachments

We were using custom rules because of some issues with Paperclip. These
rules work fine, but since we're already using the file_validators gem,
we might as well simplify the code a little bit.
This commit is contained in:
Javi Martín
2021-07-28 02:51:49 +02:00
parent 7212657c02
commit 5ff66f96cd
3 changed files with 22 additions and 21 deletions

View File

@@ -29,7 +29,7 @@ shared_examples "document validations" do |documentable_factory|
end
it "is not valid for attachments larger than documentable max_file_size definition" do
allow(document).to receive(:attachment_file_size).and_return(maxfilesize.megabytes + 1.byte)
allow(document.attachment).to receive(:byte_size).and_return(maxfilesize.megabytes + 1.byte)
max_size_error_message = "must be in between 0 Bytes and #{maxfilesize} MB"
expect(document).not_to be_valid