spec/spec_helper.rb in imap-backup-0.0.3 vs spec/spec_helper.rb in imap-backup-0.0.4
- old
+ new
@@ -12,5 +12,31 @@
end
end
require File.expand_path( File.dirname(__FILE__) + '/../lib/imap/backup' )
+module HighLineTestHelpers
+
+ def prepare_highline
+ @input = stub('stdin', :eof? => false)
+ # default gets stub
+ @input.stub!(:gets).with().and_return("q\n")
+ @output = StringIO.new
+ Imap::Backup::Configuration::Setup.highline = HighLine.new(@input, @output)
+ [@input, @output]
+ end
+
+end
+
+module InputOutputTestHelpers
+
+ def capturing_output
+ output = StringIO.new
+ $stdout = output
+ yield
+ output.string
+ ensure
+ $stdout = STDOUT
+ end
+
+end
+