From f9aac387ec8580df21917ac700ae4bfa23311a62 Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Thu, 26 Oct 2023 03:16:27 -0500 Subject: [PATCH] Use Tempfile.create to get an actual IO Tempfile.new under the standard tempfile library returns a Delegate wrapped around an IO, so it would not have our JI addons. See #7973 --- spec/java_integration/addons/file_spec.rb | 2 +- spec/java_integration/addons/io_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/java_integration/addons/file_spec.rb b/spec/java_integration/addons/file_spec.rb index e3d5a7b8182a..8c0d140ab317 100644 --- a/spec/java_integration/addons/file_spec.rb +++ b/spec/java_integration/addons/file_spec.rb @@ -5,7 +5,7 @@ before(:all) { require 'tempfile' } it "is coercible to java.io.File" do - file = Tempfile.new("io_spec").to_java 'java.io.File' + file = Tempfile.create("io_spec").to_java 'java.io.File' expect(java.io.File).to be === file file = File.open(__FILE__).to_java java.io.File expect(java.io.File).to be === file diff --git a/spec/java_integration/addons/io_spec.rb b/spec/java_integration/addons/io_spec.rb index 19a824c1ed82..9e16936873c2 100644 --- a/spec/java_integration/addons/io_spec.rb +++ b/spec/java_integration/addons/io_spec.rb @@ -87,7 +87,7 @@ it "is coercible using to_java to java.io.OutputStream" do - file = Tempfile.new("io_spec") + file = Tempfile.create("io_spec") stream = file.to_java 'java.io.OutputStream' expect(java.io.OutputStream).to be === stream