Skip to content

Commit

Permalink
Use === instead of is_a?
Browse files Browse the repository at this point in the history
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..
  • Loading branch information
nevinera committed Jun 30, 2024
1 parent da06053 commit ceb2c96
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions spec/rspec/support/spec/stderr_splitter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ceb2c96

Please sign in to comment.