Class: GreenPepper::WriteExceptionExampleResult

Inherits:
ErrorExampleResult show all
Defined in:
lib/greenpepper/writer/htmlresult.rb

Instance Attribute Summary collapse

Attributes inherited from HtmlExampleResult

#column, #row

Attributes inherited from ExampleResult

#silent

Instance Method Summary collapse

Methods inherited from ErrorExampleResult

#error?

Methods inherited from ExampleResult

#error?, #failure?, #ignored?, #success?, #update_stats

Constructor Details

#initialize(exception, silent = false) ⇒ WriteExceptionExampleResult

Returns a new instance of WriteExceptionExampleResult.



139
140
141
142
# File 'lib/greenpepper/writer/htmlresult.rb', line 139

def initialize(exception, silent=false)
  super(silent)
  @exception = exception
end

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



137
138
139
# File 'lib/greenpepper/writer/htmlresult.rb', line 137

def exception
  @exception
end

Instance Method Details

#write(cell, options = {}) ⇒ Object



144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/greenpepper/writer/htmlresult.rb', line 144

def write(cell, options = {})
  cell = super(cell, options)

  cell.content = "#{@exception.class}: #{@exception.to_s}"
  if @exception.backtrace && !options[:no_exception_stack]
    cell << LibXML::XML::Node.new('hr')
    @exception.backtrace.each { |step|
      cell << step
      cell << LibXML::XML::Node.new('br')
    }
  end
  cell
end