From fcad2b93aaf398615ee76a855d79ffb9d3d132db Mon Sep 17 00:00:00 2001 From: Amir Yalon Date: Wed, 5 Aug 2026 14:22:25 +0300 Subject: [PATCH 1/2] Relax dependency on image_processing to allow updates to `~> 2.0` Add `ruby-vips` as dependency for testing because `image_processing` no longer hard-requires it. Also adjust the tests to the changing exceptions that may be raised by `mini_magick` on failure to execute. --- carrierwave.gemspec | 3 ++- spec/processing/mini_magick_spec.rb | 11 ++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/carrierwave.gemspec b/carrierwave.gemspec index f069d1717..a437b8808 100644 --- a/carrierwave.gemspec +++ b/carrierwave.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |s| s.add_dependency "activesupport", ">= 6.0.0" s.add_dependency "activemodel", ">= 6.0.0" - s.add_dependency "image_processing", "~> 1.1" + s.add_dependency "image_processing", [">= 1.1", "< 3"] s.add_dependency "marcel", "~> 1.0.0" s.add_dependency "addressable", "~> 2.6" s.add_dependency "ssrf_filter", "~> 1.0" @@ -36,6 +36,7 @@ Gem::Specification.new do |s| s.add_development_dependency "fog-google", ["~> 1.7", "!= 1.12.1"] s.add_development_dependency "fog-local" s.add_development_dependency "mini_magick" + s.add_development_dependency "ruby-vips" if RUBY_ENGINE != 'jruby' && ENV['GITHUB_JOB'] != 'rubocop' s.add_development_dependency "rmagick", ">= 2.16" diff --git a/spec/processing/mini_magick_spec.rb b/spec/processing/mini_magick_spec.rb index 32517460a..1824da1b4 100644 --- a/spec/processing/mini_magick_spec.rb +++ b/spec/processing/mini_magick_spec.rb @@ -1,5 +1,4 @@ require 'spec_helper' -require 'open3' describe CarrierWave::MiniMagick do let(:klass) { Class.new(CarrierWave::Uploader::Base) { include CarrierWave::MiniMagick } } @@ -283,12 +282,11 @@ context "of being configured to use ImageMagick but failing to execute" do before do allow(MiniMagick).to receive(:processor).and_return(:magick) - allow(Open3).to receive(:capture3).and_raise(Errno::ENOENT) - allow_any_instance_of(MiniMagick::Shell).to receive(:execute_open3).and_raise(Errno::ENOENT) + allow_any_instance_of(MiniMagick::Shell).to receive(:execute).and_raise(Errno::ENOENT) end it "raises MiniMagick::Error" do - expect { instance.resize_to_limit(200, 200) }.to raise_exception(MiniMagick::Error) + expect { instance.resize_to_limit(200, 200) }.to raise_exception end end end @@ -332,8 +330,7 @@ context "on being configured to use ImageMagick but failing to execute" do before do allow(MiniMagick).to receive(:processor).and_return(:magick) - allow(Open3).to receive(:capture3).and_raise(Errno::ENOENT) - allow_any_instance_of(MiniMagick::Shell).to receive(:execute_open3).and_raise(Errno::ENOENT) + allow_any_instance_of(MiniMagick::Shell).to receive(:execute).and_raise(Errno::ENOENT) end after { MiniMagick.remove_instance_variable(:@processor) if MiniMagick.instance_variable_defined?(:@processor) } @@ -342,7 +339,7 @@ instance.manipulate! do |image| image.format('png') end - end.to raise_exception(minimagick_error) + end.to raise_exception end end end From 81b425a5a1d8b2e9a666f928e9e72aa95e42731d Mon Sep 17 00:00:00 2001 From: Amir Yalon Date: Mon, 10 Aug 2026 15:03:31 +0300 Subject: [PATCH 2/2] --- spec/processing/mini_magick_spec.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spec/processing/mini_magick_spec.rb b/spec/processing/mini_magick_spec.rb index 1824da1b4..2e500eab2 100644 --- a/spec/processing/mini_magick_spec.rb +++ b/spec/processing/mini_magick_spec.rb @@ -1,4 +1,5 @@ require 'spec_helper' +require 'open3' describe CarrierWave::MiniMagick do let(:klass) { Class.new(CarrierWave::Uploader::Base) { include CarrierWave::MiniMagick } } @@ -282,11 +283,11 @@ context "of being configured to use ImageMagick but failing to execute" do before do allow(MiniMagick).to receive(:processor).and_return(:magick) - allow_any_instance_of(MiniMagick::Shell).to receive(:execute).and_raise(Errno::ENOENT) + allow(Open3).to receive(:popen3).and_raise(Errno::ENOENT) end it "raises MiniMagick::Error" do - expect { instance.resize_to_limit(200, 200) }.to raise_exception + expect { instance.resize_to_limit(200, 200) }.to raise_exception(MiniMagick::Error) end end end @@ -330,7 +331,7 @@ context "on being configured to use ImageMagick but failing to execute" do before do allow(MiniMagick).to receive(:processor).and_return(:magick) - allow_any_instance_of(MiniMagick::Shell).to receive(:execute).and_raise(Errno::ENOENT) + allow(Open3).to receive(:popen3).and_raise(Errno::ENOENT) end after { MiniMagick.remove_instance_variable(:@processor) if MiniMagick.instance_variable_defined?(:@processor) } @@ -339,7 +340,7 @@ instance.manipulate! do |image| image.format('png') end - end.to raise_exception + end.to raise_exception(minimagick_error) end end end