Module: RSpec::Matchers::BuiltIn::CaptureStdout

Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/output.rb

Class Method Summary collapse

Class Method Details

.capture(block) ⇒ Object



144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/output.rb', line 144

def self.capture(block)
  captured_stream = StringIO.new

  original_stream = $stdout
  $stdout = captured_stream

  block.call

  captured_stream.string
ensure
  $stdout = original_stream
end

.nameObject



140
141
142
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/output.rb', line 140

def self.name
  'stdout'
end