Class: Pione::TestHelper::CommandResult
- Inherits:
-
StructX
- Object
- StructX
- Pione::TestHelper::CommandResult
- 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
-
#report ⇒ Object
Print the command result report.
-
#success? ⇒ Boolean
Return true if the command succeeded.
Instance Method Details
#report ⇒ Object
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. 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.
11 12 13 |
# File 'lib/pione/test-helper/command-helper.rb', line 11 def success? exception.kind_of?(SystemExit) and exception.success? end |