Skip to content

Commit 5dfc0d6

Browse files
authored
Merge pull request #11574 from neinteractiveliterature/renovate/image_processing-2.x
Update dependency image_processing to v2
2 parents e5f2eb2 + 03c9781 commit 5dfc0d6

3 files changed

Lines changed: 27 additions & 6 deletions

File tree

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ gem "civil_service", github: "neinteractiveliterature/civil_service", branch: "n
5050

5151
# File uploading
5252
gem "aws-sdk-s3"
53-
gem "image_processing", "~> 1.2"
53+
gem "image_processing", "~> 2.0"
5454
gem "ruby-vips"
5555

5656
# Filthy lucre

Gemfile.lock

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,7 @@ GEM
335335
logger
336336
ostruct
337337
ice_cube (0.17.0)
338-
image_processing (1.14.0)
339-
mini_magick (>= 4.9.5, < 6)
340-
ruby-vips (>= 2.0.17, < 3)
338+
image_processing (2.0.2)
341339
io-console (0.8.2)
342340
irb (1.18.0)
343341
pp (>= 0.6.0)
@@ -377,7 +375,6 @@ GEM
377375
memory_profiler (1.1.0)
378376
method_source (1.0.0)
379377
mini_histogram (0.3.1)
380-
mini_magick (4.13.2)
381378
mini_mime (1.1.5)
382379
minitest (6.0.6)
383380
drb (~> 2.0)
@@ -756,7 +753,7 @@ DEPENDENCIES
756753
graphql-rails_logger
757754
holidays
758755
icalendar
759-
image_processing (~> 1.2)
756+
image_processing (~> 2.0)
760757
liquid
761758
listen
762759
lograge
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# frozen_string_literal: true
2+
3+
require "test_helper"
4+
5+
class ActiveStorageAttachmentTest < ActiveSupport::TestCase
6+
let(:convention) { create(:convention) }
7+
let(:event) { create(:event, convention:) }
8+
9+
it "can generate a resized variant of an attached image" do
10+
event.images.attach(
11+
io: Rails.root.join("test/files/war_bond.png").open,
12+
filename: "war_bond.png",
13+
content_type: "image/png"
14+
)
15+
16+
attachment = event.images.first
17+
assert attachment.representable?, "Expected PNG attachment to be representable"
18+
19+
# Exercises image_processing - calls into the vips pipeline via resize_to_limit.
20+
# This is the same operation used by ActiveStorageAttachmentType#resized_url.
21+
variant = attachment.representation(resize_to_limit: [100, 100]).processed
22+
assert variant.present?
23+
end
24+
end

0 commit comments

Comments
 (0)