From bea8d337b2d295b94bb0ebb5b075f7814c46dc27 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 23 Oct 2018 08:45:06 +1100 Subject: [PATCH] DEV: ensure resizing test does not raise bad error Current resizing test was showing binary diff in terminal and failing in latest image magick 7, this fixes both issues --- spec/models/optimized_image_spec.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spec/models/optimized_image_spec.rb b/spec/models/optimized_image_spec.rb index 9d7db74d4cd..5bc7bcfd7b7 100644 --- a/spec/models/optimized_image_spec.rb +++ b/spec/models/optimized_image_spec.rb @@ -37,6 +37,8 @@ describe OptimizedImage do # we use "filename" to get the correct extension here, it is more important # then any other param + orig_size = File.size(original_path) + OptimizedImage.resize( original_path, original_path, @@ -45,9 +47,8 @@ describe OptimizedImage do filename: "test.png" ) - expect(File.read(original_path)).to eq( - File.read("#{Rails.root}/spec/fixtures/images/resized.png") - ) + expect(orig_size).to be > File.size(original_path) + ensure File.delete(original_path) if File.exists?(original_path) end