Module: RobustExcelOle::SpecHelpers
- Defined in:
- lib/spec_helper.rb
Overview
:nodoc: #
Instance Method Summary collapse
-
#capture(stream) ⇒ Object
This method is almost copy of wycats’s implementation.
-
#create_tmpdir ⇒ Object
:nodoc: #.
-
#rm_tmp(tmpdir) ⇒ Object
:nodoc: #.
Instance Method Details
#capture(stream) ⇒ Object
This method is almost copy of wycats’s implementation. pochi.hatenablog.jp/entries/2010/03/24
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/spec_helper.rb', line 20 def capture(stream) # :nodoc: # begin stream = stream.to_s eval "$#{stream} = StringIO.new" yield result = eval("$#{stream}").string ensure eval("$#{stream} = #{stream.upcase}") end result end |
#create_tmpdir ⇒ Object
:nodoc: #
8 9 10 11 12 |
# File 'lib/spec_helper.rb', line 8 def create_tmpdir tmpdir = Dir.mktmpdir FileUtils.cp_r(File.join(File.dirname(__FILE__), 'data'), tmpdir) tmpdir + '/data' end |
#rm_tmp(tmpdir) ⇒ Object
:nodoc: #
14 15 16 |
# File 'lib/spec_helper.rb', line 14 def rm_tmp(tmpdir) # :nodoc: # FileUtils.remove_entry_secure(File.dirname(tmpdir)) end |