mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
REFACTOR: upload workflow creation into UploadCreator
- Automatically convert large-ish PNG/BMP to JPEG - Updated fast_image to latest version
This commit is contained in:
@ -48,7 +48,7 @@ describe UploadsController do
|
||||
end
|
||||
|
||||
it 'is successful with an image' do
|
||||
Jobs.expects(:enqueue).with(:create_thumbnails, anything)
|
||||
Jobs.expects(:enqueue).with(:create_avatar_thumbnails, anything)
|
||||
|
||||
message = MessageBus.track_publish do
|
||||
xhr :post, :create, file: logo, type: "avatar"
|
||||
@ -78,7 +78,7 @@ describe UploadsController do
|
||||
SiteSetting.authorized_extensions = "*"
|
||||
controller.stubs(:is_api?).returns(true)
|
||||
|
||||
Jobs.expects(:enqueue).with(:create_thumbnails, anything)
|
||||
Jobs.expects(:enqueue).with(:create_avatar_thumbnails, anything)
|
||||
|
||||
stub_request(:get, "http://example.com/image.png").to_return(body: File.read('spec/fixtures/images/logo.png'))
|
||||
|
||||
@ -92,7 +92,7 @@ describe UploadsController do
|
||||
|
||||
it 'correctly sets retain_hours for admins' do
|
||||
log_in :admin
|
||||
Jobs.expects(:enqueue).with(:create_thumbnails, anything)
|
||||
Jobs.expects(:enqueue).with(:create_avatar_thumbnails, anything).never
|
||||
|
||||
message = MessageBus.track_publish do
|
||||
xhr :post, :create, file: logo, retain_hours: 100, type: "profile_background"
|
||||
@ -110,7 +110,7 @@ describe UploadsController do
|
||||
end.first
|
||||
|
||||
expect(response.status).to eq 200
|
||||
expect(message.data["errors"]).to eq(I18n.t("upload.file_missing"))
|
||||
expect(message.data["errors"]).to contain_exactly(I18n.t("upload.file_missing"))
|
||||
end
|
||||
|
||||
it 'properly returns errors' do
|
||||
@ -139,7 +139,7 @@ describe UploadsController do
|
||||
end
|
||||
|
||||
it 'returns an error when it could not determine the dimensions of an image' do
|
||||
Jobs.expects(:enqueue).with(:create_thumbnails, anything).never
|
||||
Jobs.expects(:enqueue).with(:create_avatar_thumbnails, anything).never
|
||||
|
||||
message = MessageBus.track_publish do
|
||||
xhr :post, :create, file: fake_jpg, type: "composer"
|
||||
@ -148,8 +148,7 @@ describe UploadsController do
|
||||
expect(response.status).to eq 200
|
||||
|
||||
expect(message.channel).to eq("/uploads/composer")
|
||||
expect(message.data["errors"]).to be
|
||||
expect(message.data["errors"][0]).to eq(I18n.t("upload.images.size_not_found"))
|
||||
expect(message.data["errors"]).to contain_exactly(I18n.t("upload.images.size_not_found"))
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user