From ceb2c96caaa93de2f25a71e3407369bd1e99c7eb Mon Sep 17 00:00:00 2001 From: Eric Mueller Date: Sat, 29 Jun 2024 23:22:40 -0400 Subject: [PATCH] Use === instead of is_a? For some reason, jruby (in ci only) is failing the new test, rejecting the assertion that the reopened $stderr is now a File. That's _fair_, changing the class of a thing after it exists doesn't seem like it should be possible, and I don't know how it is; it wouldn't surprise me if jruby _also_ assumes that can't happen somewhere.. --- spec/rspec/support/spec/stderr_splitter_spec.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spec/rspec/support/spec/stderr_splitter_spec.rb b/spec/rspec/support/spec/stderr_splitter_spec.rb index 5f7258ec..5b8e7bde 100644 --- a/spec/rspec/support/spec/stderr_splitter_spec.rb +++ b/spec/rspec/support/spec/stderr_splitter_spec.rb @@ -103,17 +103,20 @@ # to do in CaptureStreamToTempfile. it 'is able to restore the stream from a cloned StdErrSplitter' do cloned = $stderr.clone - expect($stderr.to_io).not_to be_a(File) + expect(File === $stderr.to_io).to be_falsey tempfile = Tempfile.new("foo") + begin $stderr.reopen(tempfile) - expect($stderr.to_io).to be_a(File) + expect(File === $stderr.to_io).to be_truthy + @checked = true ensure $stderr.reopen(cloned) tempfile.close tempfile.unlink end - expect($stderr.to_io).not_to be_a(File) + expect(File === $stderr.to_io).to be_falsey + expect(@checked).to be_truthy end end