Class: Qualspec::Suite::HtmlReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/qualspec/suite/html_reporter.rb

Instance Method Summary collapse

Constructor Details

#initialize(results) ⇒ HtmlReporter

Returns a new instance of HtmlReporter.



8
9
10
# File 'lib/qualspec/suite/html_reporter.rb', line 8

def initialize(results)
  @results = results
end

Instance Method Details

#to_htmlObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/qualspec/suite/html_reporter.rb', line 12

def to_html
  <<~HTML
    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>#{h(@results.suite_name)} - Qualspec Report</title>
      #{styles}
    </head>
    <body>
      <div class="container">
        #{header_section}
        #{config_section}
        #{summary_section}
        #{performance_section}
        #{detailed_results_section}
        #{responses_section}
        #{winner_section}
        #{footer_section}
      </div>
    </body>
    </html>
  HTML
end

#write(path) ⇒ Object



38
39
40
# File 'lib/qualspec/suite/html_reporter.rb', line 38

def write(path)
  File.write(path, to_html)
end