class RSpec::Matchers::BuiltIn::CaptureStreamToTempfile
@private
Public Instance Methods
capture(block)
click to toggle source
# File lib/rspec/matchers/built_in/output.rb, line 174 def capture(block) original_stream = stream.clone captured_stream = Tempfile.new(name) begin captured_stream.sync = true stream.reopen(captured_stream) block.call captured_stream.rewind captured_stream.read ensure stream.reopen(original_stream) captured_stream.close captured_stream.unlink end end