mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FIX: crop & optimize user background profile/card images
This commit is contained in:
parent
00aaa692ac
commit
b0802abae2
9 changed files with 70 additions and 64 deletions
|
@ -45,7 +45,10 @@ describe Upload do
|
|||
|
||||
context "#create_for" do
|
||||
|
||||
before { Upload.stubs(:fix_image_orientation) }
|
||||
before do
|
||||
Upload.stubs(:fix_image_orientation)
|
||||
ImageOptim.any_instance.stubs(:optimize_image!)
|
||||
end
|
||||
|
||||
it "does not create another upload if it already exists" do
|
||||
Upload.expects(:find_by).with(sha1: image_sha1).returns(upload)
|
||||
|
@ -65,13 +68,6 @@ describe Upload do
|
|||
Upload.create_for(user_id, image, image_filename, image_filesize)
|
||||
end
|
||||
|
||||
it "does not create an upload when there is an error with FastImage" do
|
||||
FileHelper.expects(:is_image?).returns(true)
|
||||
Upload.expects(:save).never
|
||||
upload = Upload.create_for(user_id, attachment, attachment_filename, attachment_filesize)
|
||||
expect(upload.errors.size).to be > 0
|
||||
end
|
||||
|
||||
it "does not compute width & height for non-image" do
|
||||
FastImage.any_instance.expects(:size).never
|
||||
upload = Upload.create_for(user_id, attachment, attachment_filename, attachment_filesize)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue