spec/spec_helper.rb in igp-0.0.1 vs spec/spec_helper.rb in igp-0.0.2
- old
+ new
@@ -1,13 +1,26 @@
require 'igp'
+require 'stringio'
+
+def capture(*streams)
+ streams.map! { |stream| stream.to_s }
+ begin
+ result = StringIO.new
+ streams.each { |stream| eval "$#{stream} = result" }
+ yield
+ ensure
+ streams.each { |stream| eval("$#{stream} = #{stream.upcase}") }
+ end
+ result.string
+end
\ No newline at end of file