Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRowe committed Sep 6, 2024
1 parent 24ccca9 commit 43db5ab
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion spec/rspec/support/spec/stderr_splitter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,29 @@

# This spec replicates what matchers do when capturing stderr, e.g `to_stderr_from_any_process`
it 'is able to restore the stream from a cloned StdErrSplitter' do
puts STDERR.fileno
puts STDERR.respond_to?(:path) && STDERR.path
if RSpec::Support::Ruby.jruby? && !RSpec::Support::Ruby.jruby_9000?
skip "JRuby < 9.0.0.0 doesn't have a predictable identifier for stdout"
#skip "JRuby < 9.0.0.0 doesn't have a predictable identifier for stdout"
end

cloned = splitter.clone
expect(splitter.to_io).to be_stderr
puts splitter.to_io.fileno

tempfile = Tempfile.new("foo")
begin
splitter.reopen(tempfile)
expect(splitter.to_io).to_not be_stderr
puts splitter.to_io.fileno
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).to be_stderr
puts splitter.to_io.fileno
end

# Detecting STDERR in a way that doesn't use a reference
Expand Down

0 comments on commit 43db5ab

Please sign in to comment.