Class: DTest::Test::FailureMessage
- Inherits:
-
Object
- Object
- DTest::Test::FailureMessage
- Defined in:
- lib/dtest/result.rb
Overview
module BAResult
Instance Attribute Summary collapse
-
#error_line ⇒ Object
Returns the value of attribute error_line.
-
#file ⇒ Object
Returns the value of attribute file.
-
#line ⇒ Object
Returns the value of attribute line.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
- #all ⇒ Object
-
#initialize(parent, name, message, backtrace) ⇒ FailureMessage
constructor
A new instance of FailureMessage.
- #location ⇒ Object
- #print ⇒ Object
Constructor Details
#initialize(parent, name, message, backtrace) ⇒ FailureMessage
Returns a new instance of FailureMessage.
45 46 47 48 49 50 51 |
# File 'lib/dtest/result.rb', line 45 def initialize(parent, name, , backtrace) @parent = parent @nane = name @message = @file, @line, @error_line = DTest::failure_line(backtrace) end |
Instance Attribute Details
#error_line ⇒ Object
Returns the value of attribute error_line.
43 44 45 |
# File 'lib/dtest/result.rb', line 43 def error_line @error_line end |
#file ⇒ Object
Returns the value of attribute file.
43 44 45 |
# File 'lib/dtest/result.rb', line 43 def file @file end |
#line ⇒ Object
Returns the value of attribute line.
43 44 45 |
# File 'lib/dtest/result.rb', line 43 def line @line end |
#name ⇒ Object
Returns the value of attribute name.
42 43 44 |
# File 'lib/dtest/result.rb', line 42 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent.
42 43 44 |
# File 'lib/dtest/result.rb', line 42 def parent @parent end |
Instance Method Details
#all ⇒ Object
61 62 63 |
# File 'lib/dtest/result.rb', line 61 def all location + @message end |
#location ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/dtest/result.rb', line 53 def location if file && line "#{file}:#{line}\n" else "" end end |
#print ⇒ Object
65 66 67 68 69 70 71 72 |
# File 'lib/dtest/result.rb', line 65 def print #str += "[#{parent}]" if parent #str += " '#{name}'\n" if name str = @message str += " Failure/Error: #{error_line}\n" if error_line str += " # #{file}:#{line}\n" if file && line puts "#{str}\n" end |