Class: CustomParallelHtmlFormatter

Inherits:
ParallelHtmlFormatter show all
Includes:
ERB::Util, HTMLReport
Defined in:
lib/sim/custom_parallel_html_formatter.rb

Constant Summary

Constants inherited from ParallelTests::RSpec::LoggerBase

ParallelTests::RSpec::LoggerBase::RSPEC_1

Instance Method Summary collapse

Methods included from HTMLReport

#example_failed_helper, #example_passed_helper, #move_tmp_to_final, #print_screenshot_helper

Methods inherited from ParallelHtmlFormatter

#dump_failures, #dump_pending, #dump_summary, #example_group_number, #example_number, #message, #percent_done, #start, #start_dump

Methods inherited from ParallelTests::RSpec::LoggerBase

#close, #lock_output, #lock_output_begin, #lock_output_end

Constructor Details

#initialize(output) ⇒ CustomParallelHtmlFormatter

Returns a new instance of CustomParallelHtmlFormatter.



10
11
12
13
14
# File 'lib/sim/custom_parallel_html_formatter.rb', line 10

def initialize(output)
  super
  #  raise "output has to be a file path!" unless output.is_a?(String)
  @output_dir = File.dirname(@output)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ParallelHtmlFormatter

Instance Method Details

#example_failed(example) ⇒ Object



20
21
22
# File 'lib/sim/custom_parallel_html_formatter.rb', line 20

def example_failed(example)
  example_failed_helper(example, @buffer)
end

#example_group_finished(example_group) ⇒ Object



28
29
30
# File 'lib/sim/custom_parallel_html_formatter.rb', line 28

def example_group_finished(example_group)
  super(example_group)
end

#example_group_started(example_group) ⇒ Object



24
25
26
# File 'lib/sim/custom_parallel_html_formatter.rb', line 24

def example_group_started(example_group)
  super(example_group)
end

#example_passed(example) ⇒ Object



16
17
18
# File 'lib/sim/custom_parallel_html_formatter.rb', line 16

def example_passed(example)
  example_passed_helper(example, @buffer)
end

#example_pending(example) ⇒ Object



40
41
42
# File 'lib/sim/custom_parallel_html_formatter.rb', line 40

def example_pending(example)
  super(example)
end

#example_started(example) ⇒ Object



32
33
34
# File 'lib/sim/custom_parallel_html_formatter.rb', line 32

def example_started(example)
  super(example)
end

#extra_failure_content(failure) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/sim/custom_parallel_html_formatter.rb', line 44

def extra_failure_content(failure)
  content = []
  content << "<span>"
  content << ""
  content << "</span>"
  super + content.join($/)
end


52
53
54
55
56
57
58
# File 'lib/sim/custom_parallel_html_formatter.rb', line 52

def link_for(file_name)
  return unless file_name && File.exists?(file_name)

  description = File.extname(file_name).upcase[1..-1]
  path = Pathname.new(file_name)
  "<a href='#{path.relative_path_from(Pathname.new(@output_dir))}'>#{description}</a>&nbsp;"
end


36
37
38
# File 'lib/sim/custom_parallel_html_formatter.rb', line 36

def print_screenshot(example)
  print_screenshot_helper(example, @buffer)
end