Sha256: 1fc6029afe79bb2b635a146d1925720041a952bc8a93b09440ad4083fc2f8070
Contents?: true
Size: 762 Bytes
Versions: 2
Compression:
Stored size: 762 Bytes
Contents
module RunHelper def flags(*sets) sets.each do |set| ARGV.clear @exit = catch(:system_exit) { command_line(*set) } end yield(subject.options) if block_given? end def command_line(*options) options.each { |opt| ARGV << opt } subject.define_singleton_method(:exit) do |*_args| throw(:system_exit, :exit) end subject.run subject.options end def capture_io require 'stringio' orig_stdout = $stdout orig_stderr = $stderr captured_stdout = StringIO.new captured_stderr = StringIO.new $stdout = captured_stdout $stderr = captured_stderr yield return captured_stdout.string, captured_stderr.string ensure $stdout = orig_stdout $stderr = orig_stderr end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mina-1.0.0.beta2 | spec/support/run_helper.rb |
mina-1.0.0.beta1 | spec/support/run_helper.rb |