From 118c0f5df23a832a6aa0635310968f56081b25bc Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Mon, 19 Aug 2024 13:04:43 +0100 Subject: [PATCH] WIP fix for Jruby spec --- Gemfile | 4 ++++ spec/rspec/support/spec/stderr_splitter_spec.rb | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 847643a5..d37d19c9 100644 --- a/Gemfile +++ b/Gemfile @@ -51,6 +51,10 @@ group :coverage do gem 'simplecov', '~> 0.8' end +if defined?(RUBY_PLATFORM) && RUBY_PLATFORM == 'java' + gem 'tempfile', require: false +end + if RUBY_VERSION < '2.0.0' || RUBY_ENGINE == 'java' gem 'json', '< 2.0.0' # is a dependency of simplecov else diff --git a/spec/rspec/support/spec/stderr_splitter_spec.rb b/spec/rspec/support/spec/stderr_splitter_spec.rb index 1b1ac0d6..c58774d3 100644 --- a/spec/rspec/support/spec/stderr_splitter_spec.rb +++ b/spec/rspec/support/spec/stderr_splitter_spec.rb @@ -101,7 +101,12 @@ # This is essentially what the `to_stderr_from_any_process` matcher attempts # to do in CaptureStreamToTempfile. - it 'is able to restore the stream from a cloned StdErrSplitter', :pending => RSpec::Support::Ruby.jruby? do + it 'is able to restore the stream from a cloned StdErrSplitter' do + if RSpec::Support::Ruby.jruby? && Tempfile.new("foo").is_a?(File) == false + require 'tempfile' + expect(Tempfile.new("foo")).to be_a(File) + end + cloned = $stderr.clone expect($stderr.to_io).not_to be_a(File)