Class: Pione::TestHelper::CommandResult

Inherits:
StructX
  • Object
show all
Defined in:
lib/pione/test-helper/command-helper.rb

Overview

CommandResult is a result of command execution. This has result status, stdout, stdin, and etc, so you can analyze and check it.

Instance Method Summary collapse

Instance Method Details

#reportObject

Print the command result report.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/pione/test-helper/command-helper.rb', line 16

def report
  unless success?
    puts "[FAIL]"
    puts "ERROR: %s" % exception.message
    exception.backtrace.each do |line|
      puts "TRACE: %s" % line
    end
    if stdout.string.size > 0
      puts "STDOUT:"
      puts stdout.string
    end
    if stderr.string.size > 0
      puts "STDERR:"
      puts stderr.string[0..100]
    end
  else
    puts "[SUCCESS]"
  end
end

#success?Boolean

Return true if the command succeeded.

Returns:

  • (Boolean)


11
12
13
# File 'lib/pione/test-helper/command-helper.rb', line 11

def success?
  exception.kind_of?(SystemExit) and exception.success?
end