Module: CommandExec::SpecHelper
- Defined in:
- lib/command_exec/spec_helper_module.rb
Instance Method Summary collapse
Instance Method Details
#capture_stderr(&block) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/command_exec/spec_helper_module.rb', line 3 def capture_stderr(&block) previous_stderr, $stderr = $stderr, StringIO.new block.call return $stderr.string ensure $stderr = previous_stderr end |
#capture_stdout(&block) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/command_exec/spec_helper_module.rb', line 11 def capture_stdout(&block) previous_stdout, $stdout = $stdout, StringIO.new block.call return $stdout.string ensure $stdout = previous_stdout end |