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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user