diff options
author | Thorsten Claus <thorstenclaus@web.de> | 2022-06-28 22:22:29 +0300 |
---|---|---|
committer | Thorsten Claus <thorstenclaus@web.de> | 2022-07-01 14:50:01 +0300 |
commit | 492ac74819cd7efc2c92bfb948f7083095dac384 (patch) | |
tree | 8ca48c488de1472623f9eb61f9e6a32c5e6f6504 /spec | |
parent | 1b2270572b7de768d8e8a67cf0017a01a275f3c8 (diff) |
Issue #8355: Adding webp as supported file format
Converting all uploaded images to the webp format.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/fixtures/autumn_1440x960.heic | bin | 0 -> 293608 bytes | |||
-rw-r--r-- | spec/models/photo_spec.rb | 17 |
2 files changed, 13 insertions, 4 deletions
diff --git a/spec/fixtures/autumn_1440x960.heic b/spec/fixtures/autumn_1440x960.heic Binary files differnew file mode 100644 index 000000000..00cc549c0 --- /dev/null +++ b/spec/fixtures/autumn_1440x960.heic diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb index 0b4996506..34c24b936 100644 --- a/spec/models/photo_spec.rb +++ b/spec/models/photo_spec.rb @@ -17,12 +17,13 @@ describe Photo, :type => :model do @aspect = @user.aspects.first @fixture_filename = 'button.png' + @fixture_name = File.join(File.dirname(__FILE__), '..', 'fixtures', @fixture_filename) @fail_fixture_name = File.join(File.dirname(__FILE__), '..', 'fixtures', 'msg.xml') - @photo = @user.build_post(:photo, :user_file => File.open(@fixture_name), :to => @aspect.id) - @photo2 = @user.build_post(:photo, :user_file => File.open(@fixture_name), :to => @aspect.id) - @saved_photo = @user.build_post(:photo, :user_file => File.open(@fixture_name), :to => @aspect.id) + @photo = @user.build_post(:photo, user_file: File.open(@fixture_name), to: @aspect.id) + @photo2 = @user.build_post(:photo, user_file: File.open(@fixture_name), to: @aspect.id) + @saved_photo = @user.build_post(:photo, user_file: File.open(@fixture_name), to: @aspect.id) @saved_photo.save end @@ -90,7 +91,7 @@ describe Photo, :type => :model do @photo.update_remote_path expect(@photo.remote_photo_path).to include("http") - expect(@photo.remote_photo_name).to include(".png") + expect(@photo.remote_photo_name).to include(".webp") end end @@ -182,7 +183,15 @@ describe Photo, :type => :model do @photo.unprocessed_image.store! file }.to raise_error CarrierWave::IntegrityError end + end + describe "converting files" do + it "convert to webp" do + with_carrierwave_processing do + @photo.unprocessed_image.store! File.open(@fixture_name) + end + expect(@photo.remote_photo_name).to include(".webp") + end end describe "remote photos" do |