class Example
Attributes
description[R]
duration[R]
exception[R]
file_path[R]
full_description[R]
metadata[R]
run_time[R]
spec[R]
status[R]
Public Class Methods
new(example)
click to toggle source
# File lib/rspec_html_formatter.rb, line 81 def initialize(example) @description = example.description @full_description = example.full_description @execution_result = example.execution_result @run_time = (@execution_result.run_time).round(5) @duration = @execution_result.run_time.to_s(:rounded, precision: 5) @status = @execution_result.status.to_s @metadata = example.metadata @file_path = @metadata[:file_path] @exception = Oopsy.new(example.exception, @file_path) @spec = nil end
Public Instance Methods
has_exception?()
click to toggle source
# File lib/rspec_html_formatter.rb, line 94 def has_exception? !@exception.klass.nil? end
has_spec?()
click to toggle source
# File lib/rspec_html_formatter.rb, line 98 def has_spec? !@spec.nil? end
klass(prefix='label-')
click to toggle source
# File lib/rspec_html_formatter.rb, line 106 def klass(prefix='label-') class_map = {passed: "#{prefix}success", failed: "#{prefix}danger", pending: "#{prefix}warning"} class_map[@status.to_sym] end
set_spec(spec)
click to toggle source
# File lib/rspec_html_formatter.rb, line 102 def set_spec(spec) @spec = spec end