spec/spec_helper.rb in applix-0.4.9 vs spec/spec_helper.rb in applix-0.4.10

- old
+ new

@@ -10,5 +10,20 @@ end config.after :each do end end + +# captures standard output streams to help testing console I/O +# +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 +