summaryrefslogtreecommitdiffstats
path: root/test/ext/capture_output.rb
diff options
context:
space:
mode:
authorZack Hobson2013-12-10 19:08:34 -0800
committerZack Hobson2013-12-10 19:08:34 -0800
commit6342ba68f15c37fc8fbc219eeeda7675ad29d5fd (patch)
tree0b5b6b6992e47efe2c76456de9a3c4e9f46fc2b5 /test/ext/capture_output.rb
parent03aaebeac787a885fb82ce1745eb6c3d2aa78ef1 (diff)
downloadhcl-6342ba68f15c37fc8fbc219eeeda7675ad29d5fd.tar.bz2
capture_output: move to test/ext
Diffstat (limited to 'test/ext/capture_output.rb')
-rw-r--r--test/ext/capture_output.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/ext/capture_output.rb b/test/ext/capture_output.rb
new file mode 100644
index 0000000..6fef849
--- /dev/null
+++ b/test/ext/capture_output.rb
@@ -0,0 +1,23 @@
+module CaptureOutput
+ def before_setup
+ super
+ $stderr = @stderr = StringIO.new
+ $stdout = @stdout = StringIO.new
+ end
+ def after_teardown
+ super
+ $stderr = STDERR
+ $stdout = STDOUT
+ end
+ def error_output
+ @stderr.string
+ end
+ def standard_output
+ @stdout.string
+ end
+end
+class HCl::TestCase < MiniTest::Unit::TestCase
+ include CaptureOutput
+end
+
+