Sha256: 6c4916bc519513c4fb12dad277fc3912b0109a42e866cd42c770b90a3a8f1cdd
Contents?: true
Size: 812 Bytes
Versions: 3
Compression:
Stored size: 812 Bytes
Contents
module VMC::TestSupport::CommandHelper def vmc(argv) stub(VMC::CLI).exit { |code| code } capture_output { VMC::CLI.start(argv + ["--debug"]) } end def expect_success print_debug_output if status != 0 expect(status).to eq 0 end def expect_failure print_debug_output if status == 0 expect(status).to eq 1 end def bool_flag(flag) "#{'no-' unless send(flag)}#{flag.to_s.gsub('_', '-')}" end def print_debug_output puts stdout.string.strip_progress_dots puts stderr.string end attr_reader :stdout, :stderr, :status def capture_output real_stdout = $stdout real_stderr = $stderr $stdout = @stdout = StringIO.new $stderr = @stderr = StringIO.new @status = yield ensure $stdout = real_stdout $stderr = real_stderr end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vmc-0.5.0.beta.12 | lib/vmc/test_support/command_helper.rb |
vmc-0.5.0.beta.11 | lib/vmc/test_support/command_helper.rb |
vmc-0.5.0.beta.10 | lib/vmc/test_support/command_helper.rb |