Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit cfae683

Browse files
authored
Merge pull request #612 from rspec/tidy-up-jruby-spec
Tidy up jruby spec for std error splitter
2 parents 7378952 + 4d7095b commit cfae683

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

spec/rspec/support/spec/stderr_splitter_spec.rb

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,21 +99,28 @@
9999
expect(splitter.to_io).not_to eq(splitter.clone.to_io)
100100
end
101101

102-
# This is essentially what the `to_stderr_from_any_process` matcher attempts
103-
# to do in CaptureStreamToTempfile.
104-
it 'is able to restore the stream from a cloned StdErrSplitter', :pending => RSpec::Support::Ruby.jruby? do
105-
cloned = $stderr.clone
106-
expect($stderr.to_io).not_to be_a(File)
102+
# This spec replicates what matchers do when capturing stderr, e.g `to_stderr_from_any_process`
103+
it 'is able to restore the stream from a cloned StdErrSplitter' do
104+
if RSpec::Support::Ruby.jruby?
105+
skip """
106+
This spec is currently unsupported on JRuby on CI due to tempfiles not being
107+
a file, this situtation was discussed here https://github.com/rspec/rspec-support/pull/598#issuecomment-2200779633
108+
"""
109+
end
110+
111+
cloned = splitter.clone
112+
expect(splitter.to_io).not_to be_a(File)
107113

108114
tempfile = Tempfile.new("foo")
109115
begin
110-
$stderr.reopen(tempfile)
111-
expect($stderr.to_io).to be_a(File)
116+
splitter.reopen(tempfile)
117+
expect(splitter.to_io).to be_a(File)
112118
ensure
113-
$stderr.reopen(cloned)
119+
splitter.reopen(cloned)
114120
tempfile.close
115121
tempfile.unlink
116122
end
117-
expect($stderr.to_io).not_to be_a(File)
123+
# This is the important part of the test that would fail without proper cloning hygeine
124+
expect(splitter.to_io).not_to be_a(File)
118125
end
119126
end

0 commit comments

Comments
 (0)