mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Remove the remaining Travis code (#13255)
The second attempt at #10041 now that all our plugins use GitHub Actions CI instead.
This commit is contained in:
@@ -6,31 +6,29 @@ describe OptimizedImage do
|
||||
let(:upload) { build(:upload) }
|
||||
before { upload.id = 42 }
|
||||
|
||||
unless ENV["TRAVIS"]
|
||||
describe '.crop' do
|
||||
it 'should produce cropped images (requires ImageMagick 7)' do
|
||||
tmp_path = "/tmp/cropped.png"
|
||||
describe '.crop' do
|
||||
it 'should produce cropped images (requires ImageMagick 7)' do
|
||||
tmp_path = "/tmp/cropped.png"
|
||||
|
||||
begin
|
||||
OptimizedImage.crop(
|
||||
"#{Rails.root}/spec/fixtures/images/logo.png",
|
||||
tmp_path,
|
||||
5,
|
||||
5
|
||||
)
|
||||
begin
|
||||
OptimizedImage.crop(
|
||||
"#{Rails.root}/spec/fixtures/images/logo.png",
|
||||
tmp_path,
|
||||
5,
|
||||
5
|
||||
)
|
||||
|
||||
# we don't want to deal with something new here every time image magick
|
||||
# is upgraded or pngquant is upgraded, lets just test the basics ...
|
||||
# cropped image should be less than 120 bytes
|
||||
# we don't want to deal with something new here every time image magick
|
||||
# is upgraded or pngquant is upgraded, lets just test the basics ...
|
||||
# cropped image should be less than 120 bytes
|
||||
|
||||
cropped_size = File.size(tmp_path)
|
||||
cropped_size = File.size(tmp_path)
|
||||
|
||||
expect(cropped_size).to be < 120
|
||||
expect(cropped_size).to be > 50
|
||||
expect(cropped_size).to be < 120
|
||||
expect(cropped_size).to be > 50
|
||||
|
||||
ensure
|
||||
File.delete(tmp_path) if File.exists?(tmp_path)
|
||||
end
|
||||
ensure
|
||||
File.delete(tmp_path) if File.exists?(tmp_path)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe UserAvatarsController do
|
||||
|
||||
context 'show_proxy_letter' do
|
||||
it 'returns not found if external avatar is set somewhere else' do
|
||||
SiteSetting.external_system_avatars_url = "https://somewhere.else.com/avatar.png"
|
||||
@@ -19,52 +18,48 @@ describe UserAvatarsController do
|
||||
end
|
||||
|
||||
context 'show' do
|
||||
context 'invalid' do
|
||||
after do
|
||||
FileUtils.rm(Discourse.store.path_for(upload))
|
||||
end
|
||||
|
||||
# travis is not good here, no image magick
|
||||
if !ENV["TRAVIS"]
|
||||
context 'invalid' do
|
||||
after do
|
||||
FileUtils.rm(Discourse.store.path_for(upload))
|
||||
let :upload do
|
||||
File.open(file_from_fixtures("cropped.png")) do |f|
|
||||
UploadCreator.new(
|
||||
f,
|
||||
"test.png"
|
||||
).create_for(-1)
|
||||
end
|
||||
end
|
||||
|
||||
let :upload do
|
||||
File.open(file_from_fixtures("cropped.png")) do |f|
|
||||
UploadCreator.new(
|
||||
f,
|
||||
"test.png"
|
||||
).create_for(-1)
|
||||
end
|
||||
end
|
||||
let(:user) do
|
||||
user = Fabricate(:user)
|
||||
user.user_avatar.update_columns(custom_upload_id: upload.id)
|
||||
user.update_columns(uploaded_avatar_id: upload.id)
|
||||
user
|
||||
end
|
||||
|
||||
let :user do
|
||||
user = Fabricate(:user)
|
||||
user.user_avatar.update_columns(custom_upload_id: upload.id)
|
||||
user.update_columns(uploaded_avatar_id: upload.id)
|
||||
user
|
||||
end
|
||||
it 'automatically corrects bad avatar extensions' do
|
||||
orig = Discourse.store.path_for(upload)
|
||||
|
||||
it 'automatically corrects bad avatar extensions' do
|
||||
orig = Discourse.store.path_for(upload)
|
||||
upload.update_columns(
|
||||
original_filename: 'bob.jpg',
|
||||
extension: 'jpg',
|
||||
url: upload.url + '.jpg'
|
||||
)
|
||||
|
||||
upload.update_columns(
|
||||
original_filename: 'bob.jpg',
|
||||
extension: 'jpg',
|
||||
url: upload.url + '.jpg'
|
||||
)
|
||||
# at this point file is messed up
|
||||
FileUtils.mv(orig, Discourse.store.path_for(upload))
|
||||
|
||||
# at this point file is messed up
|
||||
FileUtils.mv(orig, Discourse.store.path_for(upload))
|
||||
SiteSetting.avatar_sizes = "50"
|
||||
|
||||
SiteSetting.avatar_sizes = "50"
|
||||
get "/user_avatar/default/#{user.username}/50/#{upload.id}.png"
|
||||
|
||||
get "/user_avatar/default/#{user.username}/50/#{upload.id}.png"
|
||||
expect(OptimizedImage.where(upload_id: upload.id).count).to eq(1)
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
expect(OptimizedImage.where(upload_id: upload.id).count).to eq(1)
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
upload.reload
|
||||
expect(upload.extension).to eq('png')
|
||||
end
|
||||
upload.reload
|
||||
expect(upload.extension).to eq('png')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user