diff --git a/spec/rspec/support/spec/stderr_splitter_spec.rb b/spec/rspec/support/spec/stderr_splitter_spec.rb index 1842d7de..972b9cbd 100644 --- a/spec/rspec/support/spec/stderr_splitter_spec.rb +++ b/spec/rspec/support/spec/stderr_splitter_spec.rb @@ -100,26 +100,24 @@ end it 'is able to restore the stream from a cloned StdErrSplitter' do - if RSpec::Support::Ruby.jruby? && Tempfile.new("foo").is_a?(File) == false - skip """ - This spec is currently unsupported on JRuby on CI due to tempfiles not being - a file, this situtation was discussed here https://github.com/rspec/rspec-support/pull/598#issuecomment-2200779633 - """ - end - cloned = splitter.clone - expect(splitter.to_io).not_to be_a(File) + expect(splitter.to_io).to be_stderr tempfile = Tempfile.new("foo") begin splitter.reopen(tempfile) - expect(splitter.to_io).to be_a(File) + expect(splitter.to_io).to_not be_stderr ensure splitter.reopen(cloned) tempfile.close tempfile.unlink end # This is the important part of the test that would fail without proper cloning hygeine - expect(splitter.to_io).not_to be_a(File) + expect(splitter.to_io).to be_stderr + end + + # Detecting STDERR in a way that doesn't use a reference + def be_stderr + have_attributes({:isatty => true, :path => ""}) end end