Class: RSpecTracer::HTMLReporter::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec_tracer/html_reporter/reporter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(report_dir, reporter) ⇒ Reporter

Returns a new instance of Reporter.



11
12
13
14
# File 'lib/rspec_tracer/html_reporter/reporter.rb', line 11

def initialize(report_dir, reporter)
  @report_dir = report_dir
  @reporter = reporter
end

Instance Attribute Details

#examplesObject (readonly)

Returns the value of attribute examples.



9
10
11
# File 'lib/rspec_tracer/html_reporter/reporter.rb', line 9

def examples
  @examples
end

#examples_dependencyObject (readonly)

Returns the value of attribute examples_dependency.



9
10
11
# File 'lib/rspec_tracer/html_reporter/reporter.rb', line 9

def examples_dependency
  @examples_dependency
end

#files_dependencyObject (readonly)

Returns the value of attribute files_dependency.



9
10
11
# File 'lib/rspec_tracer/html_reporter/reporter.rb', line 9

def files_dependency
  @files_dependency
end

#flaky_examplesObject (readonly)

Returns the value of attribute flaky_examples.



9
10
11
# File 'lib/rspec_tracer/html_reporter/reporter.rb', line 9

def flaky_examples
  @flaky_examples
end

#last_runObject (readonly)

Returns the value of attribute last_run.



9
10
11
# File 'lib/rspec_tracer/html_reporter/reporter.rb', line 9

def last_run
  @last_run
end

Instance Method Details

#generate_reportObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rspec_tracer/html_reporter/reporter.rb', line 16

def generate_report
  starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)

  prepare

  file_name = File.join(@report_dir, 'index.html')

  File.open(file_name, 'wb') do |file|
    file.puts(template('layout').result(binding))
  end

  ending = Process.clock_gettime(Process::CLOCK_MONOTONIC)
  elapsed = RSpecTracer::TimeFormatter.format_time(ending - starting)

  puts "RSpecTracer generated HTML report to #{file_name} (took #{elapsed})"
end