Skip imagemagick tests on Travis.

This commit is contained in:
Guo Xiang Tan 2018-07-17 17:11:05 +08:00
parent 3553375dd2
commit d839a42bf9
1 changed files with 48 additions and 46 deletions

View File

@ -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