Module: TestHelpers
- Included in:
- Bacon::Context
- Defined in:
- lib/bbcloud/vendor/hirb-0.3.4/test/test_helper.rb
Instance Method Summary collapse
- #capture_stderr(&block) ⇒ Object
- #capture_stdout(&block) ⇒ Object
- #reset_config ⇒ Object
- #reset_terminal_size ⇒ Object
Instance Method Details
#capture_stderr(&block) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/bbcloud/vendor/hirb-0.3.4/test/test_helper.rb', line 26 def capture_stderr(&block) original_stderr = $stderr $stderr = fake = StringIO.new begin yield ensure $stderr = original_stderr end fake.string end |
#capture_stdout(&block) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/bbcloud/vendor/hirb-0.3.4/test/test_helper.rb', line 15 def capture_stdout(&block) original_stdout = $stdout $stdout = fake = StringIO.new begin yield ensure $stdout = original_stdout end fake.string end |
#reset_config ⇒ Object
37 38 39 |
# File 'lib/bbcloud/vendor/hirb-0.3.4/test/test_helper.rb', line 37 def reset_config View.instance_eval "@config = nil" end |
#reset_terminal_size ⇒ Object
11 12 13 |
# File 'lib/bbcloud/vendor/hirb-0.3.4/test/test_helper.rb', line 11 def reset_terminal_size ENV["LINES"] = ENV["COLUMNS"] = "20" end |