class Example
Attributes
description[R]
duration[R]
example_group[R]
exception[R]
failed_screenshot[R]
file_path[R]
full_description[R]
metadata[R]
run_time[R]
screenrecord[R]
screenshots[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) @example_group = example.example_group.to_s @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 @screenshots = @metadata[:screenshots] @screenrecord = @metadata[:screenrecord] @failed_screenshot = @metadata[:failed_screenshot] end
Public Instance Methods
example_title()
click to toggle source
# File lib/rspec_html_formatter.rb, line 98 def example_title title_arr = @example_group.to_s.split('::') - ['RSpec', 'ExampleGroups'] title_arr.push @description title_arr.join(' → ') end
has_exception?()
click to toggle source
# File lib/rspec_html_formatter.rb, line 105 def has_exception? !@exception.klass.nil? end
has_failed_screenshot?()
click to toggle source
# File lib/rspec_html_formatter.rb, line 121 def has_failed_screenshot? !@failed_screenshot.nil? end
has_screenrecord?()
click to toggle source
# File lib/rspec_html_formatter.rb, line 117 def has_screenrecord? !@screenrecord.nil? end
has_screenshots?()
click to toggle source
# File lib/rspec_html_formatter.rb, line 113 def has_screenshots? !@screenshots.nil? && !@screenshots.empty? end
has_spec?()
click to toggle source
# File lib/rspec_html_formatter.rb, line 109 def has_spec? !@spec.nil? end
klass(prefix='label-')
click to toggle source
# File lib/rspec_html_formatter.rb, line 129 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 125 def set_spec(spec) @spec = spec end