mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 07:33:51 +08:00
Skip imagemagick tests on Travis.
This commit is contained in:
parent
90802053a0
commit
c4de36624f
|
@ -4,64 +4,66 @@ describe OptimizedImage do
|
|||
let(:upload) { build(:upload) }
|
||||
before { upload.id = 42 }
|
||||
|
||||
describe '.crop' do
|
||||
it 'should work correctly' do
|
||||
tmp_path = "/tmp/cropped.png"
|
||||
unless ENV["TRAVIS"]
|
||||
describe '.crop' do
|
||||
it 'should work correctly' 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
|
||||
)
|
||||
|
||||
expect(File.read(tmp_path)).to eq(
|
||||
File.read("#{Rails.root}/spec/fixtures/images/cropped.png")
|
||||
)
|
||||
ensure
|
||||
File.delete(tmp_path) if File.exists?(tmp_path)
|
||||
expect(File.read(tmp_path)).to eq(
|
||||
File.read("#{Rails.root}/spec/fixtures/images/cropped.png")
|
||||
)
|
||||
ensure
|
||||
File.delete(tmp_path) if File.exists?(tmp_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '.resize' do
|
||||
it 'should work correctly' do
|
||||
tmp_path = "/tmp/resized.png"
|
||||
describe '.resize' do
|
||||
it 'should work correctly' do
|
||||
tmp_path = "/tmp/resized.png"
|
||||
|
||||
begin
|
||||
OptimizedImage.resize(
|
||||
"#{Rails.root}/spec/fixtures/images/logo.png",
|
||||
tmp_path,
|
||||
5,
|
||||
5
|
||||
)
|
||||
begin
|
||||
OptimizedImage.resize(
|
||||
"#{Rails.root}/spec/fixtures/images/logo.png",
|
||||
tmp_path,
|
||||
5,
|
||||
5
|
||||
)
|
||||
|
||||
expect(File.read(tmp_path)).to eq(
|
||||
File.read("#{Rails.root}/spec/fixtures/images/resized.png")
|
||||
)
|
||||
ensure
|
||||
File.delete(tmp_path) if File.exists?(tmp_path)
|
||||
expect(File.read(tmp_path)).to eq(
|
||||
File.read("#{Rails.root}/spec/fixtures/images/resized.png")
|
||||
)
|
||||
ensure
|
||||
File.delete(tmp_path) if File.exists?(tmp_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '.downsize' do
|
||||
it 'should work correctly' do
|
||||
tmp_path = "/tmp/downsized.png"
|
||||
describe '.downsize' do
|
||||
it 'should work correctly' do
|
||||
tmp_path = "/tmp/downsized.png"
|
||||
|
||||
begin
|
||||
OptimizedImage.downsize(
|
||||
"#{Rails.root}/spec/fixtures/images/logo.png",
|
||||
tmp_path,
|
||||
'100x100>'
|
||||
)
|
||||
begin
|
||||
OptimizedImage.downsize(
|
||||
"#{Rails.root}/spec/fixtures/images/logo.png",
|
||||
tmp_path,
|
||||
'100x100>'
|
||||
)
|
||||
|
||||
expect(File.read(tmp_path)).to eq(
|
||||
File.read("#{Rails.root}/spec/fixtures/images/downsized.png")
|
||||
)
|
||||
ensure
|
||||
File.delete(tmp_path) if File.exists?(tmp_path)
|
||||
expect(File.read(tmp_path)).to eq(
|
||||
File.read("#{Rails.root}/spec/fixtures/images/downsized.png")
|
||||
)
|
||||
ensure
|
||||
File.delete(tmp_path) if File.exists?(tmp_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user