diff -Nur a/spec/lib/mini_magick/image_spec.rb b/spec/lib/mini_magick/image_spec.rb
--- a/spec/lib/mini_magick/image_spec.rb	2022-02-25 09:21:57.370368608 +0800
+++ b/spec/lib/mini_magick/image_spec.rb	2022-02-25 09:24:14.804683516 +0800
@@ -79,7 +79,7 @@
         it "doesn't allow remote shell execution" do
           expect {
             described_class.open("| touch file.txt") # Kernel#open accepts this
-          }.to raise_error(URI::InvalidURIError)
+          }.to raise_error(Errno::ENOENT)
 
           expect(File.exist?("file.txt")).to eq(false)
         end
