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:
@@ -38,7 +38,7 @@ shared_examples "image validations" do |imageable_factory|
|
||||
|
||||
it "is not valid for attachments larger than imageable max_file_size definition" do
|
||||
larger_size = Setting["uploads.images.max_size"].to_i.megabytes + 1.byte
|
||||
allow(image).to receive(:attachment_file_size).and_return(larger_size)
|
||||
allow(image.attachment).to receive(:byte_size).and_return(larger_size)
|
||||
|
||||
expect(image).not_to be_valid
|
||||
expect(image.errors[:attachment]).to include "must be in between 0 Bytes and 1 MB"
|
||||
|
||||
Reference in New Issue
Block a user