spec/spec_helper.rb in jnunemaker-twitter-0.4.0 vs spec/spec_helper.rb in jnunemaker-twitter-0.4.1
- old
+ new
@@ -7,6 +7,17 @@
end
dir = File.dirname(__FILE__)
$:.unshift(File.join(dir, '/../lib/'))
-require dir + '/../lib/twitter'
+require dir + '/../lib/twitter'
+
+
+def stdout_for(&block)
+ # Inspired by http://www.ruby-forum.com/topic/58647
+ old_stdout = $stdout
+ $stdout = StringIO.new
+ yield
+ output = $stdout.string
+ $stdout = old_stdout
+ output
+end
\ No newline at end of file